# Can i use an HLS video stream as a Video Dome source?

**URL:** <https://forum.babylonjs.com/t/can-i-use-an-hls-video-stream-as-a-video-dome-source/46032>\
**Category:** Questions\
**Tags:** webxr, xr, vr\
**Created:** [November 29, 2023, 1:49pm UTC](https://forum.babylonjs.com/t/can-i-use-an-hls-video-stream-as-a-video-dome-source/46032 "2023-11-29T13:49:59Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Coder1337](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/coder1337/32/35706_2.png) [@Coder1337](https://forum.babylonjs.com/u/Coder1337)\
**Post date:** [November 29, 2023, 1:49pm UTC](https://forum.babylonjs.com/t/can-i-use-an-hls-video-stream-as-a-video-dome-source/46032/1 "2023-11-29T13:49:59Z")

</div>

**I’m trying to use an HLS encoded video stream as the source for my 180 stereo video dome.**

> The Video in the playground isn’t stereo and the video dome is not set up to be, this is merely about loading the video in general

_Expected Behavior:_  
The video should load onto the video element

_Result:_  
The playlist does not load and the video does not play

**[Playground](https://playground.babylonjs.com/#GEA3P0)**

> There are some libraries that can manipulate the video element and create their own player to stream the video but since i can’t replace the video dome element with a player because i need the stereo functionality this is not a possible solution so i guess i’m requesting a feature if this is not supported currently? It would be really nice if this could be handled by babylon in the future to eliminate loading times of large vr videos.

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [November 29, 2023, 3:22pm UTC](https://forum.babylonjs.com/t/can-i-use-an-hls-video-stream-as-a-video-dome-source/46032/2 "2023-11-29T15:22:28Z")

</div>

The abstract answer is - we support any video that is supported in your browser. If your browser can play it in a video HTML element, Babylon should support it. If it does work in an HTML element, but doesn’t work in Bbylon, I will be very happy to check what happened.  
If there is an external player that can decode the video, we can see if we can integrate it, but that would require changes in the video texture and the engine itself - and to be honest will not happen any time soon. The best would be if the custom player can stream to an Video HTML element, this way you can just use babylon as is.

---

<div class="post-metadata">

**Author:** ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)\
**Post date:** [November 29, 2023, 11:30pm UTC](https://forum.babylonjs.com/t/can-i-use-an-hls-video-stream-as-a-video-dome-source/46032/3 "2023-11-29T23:30:47Z")

</div>

Here is the example of HLS Video Dome - [https://playground.babylonjs.com/#7279JP#2](https://playground.babylonjs.com/#7279JP#2)

Another example - video texture from DASH video format - [https://playground.babylonjs.com/#9FSDC7#234](https://playground.babylonjs.com/#9FSDC7#234)

---

<div class="post-metadata">

**Author:** ![Coder1337](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/coder1337/32/35706_2.png) [@Coder1337](https://forum.babylonjs.com/u/Coder1337)\
**Post date:** [December 1, 2023, 3:51pm UTC](https://forum.babylonjs.com/t/can-i-use-an-hls-video-stream-as-a-video-dome-source/46032/4 "2023-12-01T15:51:23Z")

</div>

This works flawlessly in vr and browser in mono, but when using a stereo video it doesn’t work until the video is completely loaded, any ideas why? all i changed was using a stereo video and changing the video mode `videoDome.videoMode = BABYLON.VideoDome.MODE_SIDEBYSIDE;` 😕

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [December 1, 2023, 3:59pm UTC](https://forum.babylonjs.com/t/can-i-use-an-hls-video-stream-as-a-video-dome-source/46032/5 "2023-12-01T15:59:07Z")

</div>

if you don’t change the video mode, does it play without waiting for the video to fully load?

---

<div class="post-metadata">

**Author:** ![Coder1337](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/coder1337/32/35706_2.png) [@Coder1337](https://forum.babylonjs.com/u/Coder1337)\
**Post date:** [December 1, 2023, 5:32pm UTC](https://forum.babylonjs.com/t/can-i-use-an-hls-video-stream-as-a-video-dome-source/46032/6 "2023-12-01T17:32:25Z")

</div>

Yes that’s what’s confusing me 😅

---

<div class="post-metadata">

**Author:** ![Coder1337](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/coder1337/32/35706_2.png) [@Coder1337](https://forum.babylonjs.com/u/Coder1337)\
**Post date:** [December 4, 2023, 8:41am UTC](https://forum.babylonjs.com/t/can-i-use-an-hls-video-stream-as-a-video-dome-source/46032/7 "2023-12-04T08:41:58Z")

</div>

I’ve replicated it in the [Playground](https://playground.babylonjs.com/#YJLYCB)

I’ve set the videoMode to side by side and i’m loading a new video when pressing the “`P`” button  
this works fine outside of vr but when entering vr it doesn’t work anymore, any ideas?

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [December 4, 2023, 11:09am UTC](https://forum.babylonjs.com/t/can-i-use-an-hls-video-stream-as-a-video-dome-source/46032/8 "2023-12-04T11:09:49Z")

</div>

if I understated correctly, the issue is when changing the video source in the HLS class, right? it seems like there will be a need of replacing the underlying video texture, but i’ll debug that and see what can be done.

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [December 4, 2023, 11:09am UTC](https://forum.babylonjs.com/t/can-i-use-an-hls-video-stream-as-a-video-dome-source/46032/9 "2023-12-04T11:09:53Z")

</div>

Assigned @RaananW on December 4, 2023, 11:09am UTC



---

<div class="post-metadata">

**Author:** ![Coder1337](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/coder1337/32/35706_2.png) [@Coder1337](https://forum.babylonjs.com/u/Coder1337)\
**Post date:** [December 4, 2023, 2:03pm UTC](https://forum.babylonjs.com/t/can-i-use-an-hls-video-stream-as-a-video-dome-source/46032/10 "2023-12-04T14:03:16Z")

</div>

I can only assume so, but it works when changing the video when not in XR so i really don’t know.

> [@RaananW](#):
>
> if I understated correctly, the issue is when changing the video source in the HLS class, right?

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [December 4, 2023, 2:06pm UTC](https://forum.babylonjs.com/t/can-i-use-an-hls-video-stream-as-a-video-dome-source/46032/11 "2023-12-04T14:06:31Z")

</div>

oh, doesn’t work for me when outside of XR as well. When I click P i stop seeing the video

---

<div class="post-metadata">

**Author:** ![Coder1337](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/coder1337/32/35706_2.png) [@Coder1337](https://forum.babylonjs.com/u/Coder1337)\
**Post date:** [December 4, 2023, 2:17pm UTC](https://forum.babylonjs.com/t/can-i-use-an-hls-video-stream-as-a-video-dome-source/46032/12 "2023-12-04T14:17:17Z")

</div>

Hm, even after clearing my cache the video starts streaming when clicking P outside of XR

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [December 4, 2023, 2:23pm UTC](https://forum.babylonjs.com/t/can-i-use-an-hls-video-stream-as-a-video-dome-source/46032/13 "2023-12-04T14:23:07Z")

</div>

Not on any browser I tested with. The video texture goes black and no video is playing

---

<div class="post-metadata">

**Author:** ![Coder1337](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/coder1337/32/35706_2.png) [@Coder1337](https://forum.babylonjs.com/u/Coder1337)\
**Post date:** [December 4, 2023, 3:06pm UTC](https://forum.babylonjs.com/t/can-i-use-an-hls-video-stream-as-a-video-dome-source/46032/14 "2023-12-04T15:06:26Z")

</div>

The line `mediaElement.play()` was missing, my bad.  
after some further testing i can’t reproduce the issue, neither on the playground nor using the default babylon template, idk what’s wrong with my code i’ll try to remove all asynchronous loading if possible.  
But also my served playlist doesn’t work where the public test stream does work so somehow i’m serving my playlist wrongfully and if i use the public test stream in my original code it also doesn’t stream which means my code is faulty too. My only hope is to remove asynchronicity if that does’t work i’ll try to create the project from the beginning

Just to check, it couldn’t possibly be that my video is stereo meaning the width and height causing issues? (2880x1440) My stream does Work outside of XR and in VLC Media player but when entering vr and loading my stream it doesn’t work so i guess it has to be smth about my stream

Sorry for wasting your guys time!

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [December 4, 2023, 3:54pm UTC](https://forum.babylonjs.com/t/can-i-use-an-hls-video-stream-as-a-video-dome-source/46032/15 "2023-12-04T15:54:43Z")

</div>

Unassigned @RaananW on December 4, 2023, 3:54pm UTC



---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [December 4, 2023, 4:00pm UTC](https://forum.babylonjs.com/t/can-i-use-an-hls-video-stream-as-a-video-dome-source/46032/16 "2023-12-04T16:00:47Z")

</div>

unless there is some limitation for video playback in XR that I am not aware of (not babylon, but WebXR itself), I can’t really think of a reason why the video will not play in VR mode. The flag is used as part of the rendering process, not as part of loading the video - we either split per eye or display a single image for both eyes. It also can’t really be the video’s dimensions. But I am open for everything!  
If you can provide a simple reproduction that I can test with - video loaded, enter XR, video stops - I will be able to provide a more detailed answer

---

<div class="post-metadata">

**Author:** ![Coder1337](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/coder1337/32/35706_2.png) [@Coder1337](https://forum.babylonjs.com/u/Coder1337)\
**Post date:** [December 5, 2023, 1:19pm UTC](https://forum.babylonjs.com/t/can-i-use-an-hls-video-stream-as-a-video-dome-source/46032/17 "2023-12-05T13:19:00Z")

</div>

Thank you, just to clarify the issue is not that the video stops playing when entering vr it actually continues playing, the issue is when in XR and trying to start a different stream the video doesn’t start playing until all parts are available, but i’ll look into it on my side, since it works with the test streams on the playground it’s either my code or my server

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [December 5, 2023, 1:41pm UTC](https://forum.babylonjs.com/t/can-i-use-an-hls-video-stream-as-a-video-dome-source/46032/18 "2023-12-05T13:41:04Z")

</div>

can you try initializing the video Dome after entering XR? does it work then?

---

<div class="post-metadata">

**Author:** ![Coder1337](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/coder1337/32/35706_2.png) [@Coder1337](https://forum.babylonjs.com/u/Coder1337)\
**Post date:** [December 12, 2023, 2:30pm UTC](https://forum.babylonjs.com/t/can-i-use-an-hls-video-stream-as-a-video-dome-source/46032/19 "2023-12-12T14:30:18Z")

</div>

After a week of testing i managed to replicate my issue in the [Playground](https://playground.babylonjs.com/#YJLYCB#3)

**How to replicate:**  
_(It’s important to clear the cache when trying what works and what doesn’t)_

✔ works  
Open Playground \> press “P” key \> video loads as expected  
Open Playground \> press “P” key \> video loads \> enter XR \> video continues loading and playing properly

❓ doesn’t work  
Open Playground \> enter XR \> press “P” key \> video seems to load in network tab but doesn’t render

sorry for the ping @RaananW but since it’s been a week i’m afraid of being forgotten 😅

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [December 12, 2023, 2:52pm UTC](https://forum.babylonjs.com/t/can-i-use-an-hls-video-stream-as-a-video-dome-source/46032/20 "2023-12-12T14:52:56Z")

</div>

Assigned @RaananW on December 12, 2023, 2:52pm UTC



[Next page](https://forum.babylonjs.com/t/can-i-use-an-hls-video-stream-as-a-video-dome-source/46032.md?page=2)
