videoTexture - duration Attribute?

How can one control the duration of a videoTexture?

Loop the first 10 seconds out of a 1 minute video?

I found this in the documentation, but I don’t really understand how to use it:

The internal video DOM object is accessible via the VideoTexture.video property… which allows you to control some characteristics and monitor the status of the video (things such as play, pause, loop, autoplay, etc). See the link above for the full story.

Hi @a_bolog.

According to W3C/DOM “video element” specification, currentTime is a readable and writeable attribute. In other words, you can use a scene observer to “watch” the video’s currentTime value, and when it gets to a certain place (10 seconds)… you can set it to a different time. Let’s try it…

https://playground.babylonjs.com/#EKFLA#296

See lines 23-27. That seems to work for my Firefox browser. You might wish to do further tests. Be well.

3 Likes

That’s quite nifty.

Thanks.

1 Like