Playing a video used in a VideoTexture without autoPlay enabled will immediately pause it

I would like to manually play a video that’s used with a VideoTexture after the video’s canplay event is fired, but doing so causes Babylon.js to immediately pause the video.

Demo:

Source of the issue in the codebase:

For some reason, the video is paused when there is no error. I’m not sure what use case this part of the code is handling, but it seems be interfering with the expected video playback, which is driven externally from the texture in my use case.

You are in a !this.video.autoplay block of code, that’s why it is pausing the playing.

If you want to manually start the video, you need to subscribe to VideoTexture.onLoadObservable as this observable is notified after the video is paused.

I understand why the logic is causing it to pause, but I don’t understand why this code should do this if autoplay is false when play is manually being called.

In my use case, I need to drive the video in a way that is agnostic of Babylon.js, so using VideoTexture is not viable. The video is managed by a component that doesn’t access Babylon.js components.

What you are saying is - if you are controlling the video externally, babylon should not do its magic, as you control it yourself?

Yes, basically that it would be nice to have an option to use a video without babylon modifying the video state. I’m not sure if there’s currently a means of doing that.

sure, I can get that. Babylon will only consume the video you are providing. That would be a nice feature.
Want to create an issue on github so we can research that?

1 Like