Mismatch between video and video current time

I was driving nuts about a problem I was facing until I realized that you cannot trust videoTex.video.currentTime because that time is not guaranteed to be the actual time, here is a sample:

You can press SPACE to run the playback again and it is supposed to advance one frame, but notice that the currentTime doesn’t match always the video frame, sometimes it does but some others don’t.

Is there any way to sync that? I mean read the actual value or forcing to redraw the texture to the currentTime value, any of both are ok.

Regards!

cc @sebavan

Btw I’ve tried to disable autoUpdateTexture and call updateTexture manually on before/after rendering but I had no luck either.

Same for material onBindObservable (I guess that play/pause doesn’t make a frame perfect match)

updateTexture makes a copy of the current videoFrame into the texture so if the videoElement is ok the texture would be.

You could try to fully manage the videoElement and see if that could solve it

Sorry I do not understand what you mean with fully manage the video element

As you can see in the constructor of the VideoTexture: VideoTexture | Babylon.js Documentation you can pass a HtmlVideoElement instead of the url.

Once done you are in charge of update seek and so on.