How to add on error observable/callback on VideoTexture

Hi, I want to handle error when the url of video is not correct when loading videotexture.
The videoTexture constructor does not has a error callback : VideoTexture | Babylon.js Documentation
I can see it has onLoadObservable function: VideoTexture | Babylon.js Documentation

How should I handle an error if the video cannot be loaded. I have modified a playground with wrong video url and if you see in the console it throws an error.

Wow… how did we miss that for 3 years?..

As you found out - there is no way to react to errors when loading a video the babylon way. If you want to create a github issue we will be happy to add an onError observable to the video texture to make sure errors are passed to the dev correctly.

In the meantime, you can always check for errors on the native video element:

tv | Babylon.js Playground ( notice line 22 - adding an event listener to the HTMLVideoElement


Sure I can create a github issue. Do you want me to add it under bug or new feature.

1 Like

new feature. and please reference this page

Created this github issue.