Adding pause/play to video texture

I have a video in my game using Videotexture where the videos are autoplaying at the same time. I have a room with 2 tvs, I want to add play&pause controls to specify by clicking on a button hopefully to play such a video. Thanks in-advance .

Hi @AhmedFarahat,

On how to add UI buttons on your game take a look at this tutorial project:

https://developer.playcanvas.com/en/tutorials/ui-elements-buttons/

For playing/pausing a video I think you’ve asked this in a previous post of yours and that was answered there.

Actually, I am trying to embed the following code in my game, to be able to control this easier, Any ideas?

<iframe width=“859” height=“537" src=“https://www.youtube.com/embed/FbMwqd9MF3c” frameborder=“0" allow=“accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture” allowfullscreen></iframe>

You can’t put iframes into a texture. They would have to be separate DOMs to the page.

yeah, worked for me, I created a script that uses html and css following this tutorial https://developer.playcanvas.com/en/tutorials/htmlcss-ui/
Now I am able to add the iframe within the game, but it is showing om all the game, is it possible to attach this script / any else to a material? so that this material would load this script that calls Html & CSS.
This is very important to do, would solve everything

As mentioned in my last reply, you cannot attach the iframe to a material.

You can control the DOM through a script though. IE, stop, play, hide etc

I don’t need the iFrame at all, but it was my last option to get any sort of controls to my video textures as I have multiple video textures that plays different videos and if I add for example an on click listener it will play/pause/stop all of my videos at the same time, which is not what I want.
if you can guide me on how to do it I’ll be glad

Going back to the original example of using a MP4 file. That uses a video DOM object: https://www.w3schools.com/tags/ref_av_dom.asp

As long as you keep a reference to the DOM, you can play, pause etc that specific video.