How to stop a youtube video, switching to another scene?

Hi Hype Team, and best wishes !

Yes how can I stop a youtube video, switching to another scene ?

Also it could be nice to have a script to say StopAllSounds, or StopAllVideo in the inspector…

Regards,

PAscal

Hi Pascal (@rapefromage)

Quick search here should find your answers.

It’s not quite clear what you mean though. Do you want to?

a. stop a video and then go to another scene or
b. wait till the video has finished and then go to another scene

maybe here you can find further details, it works

code by @rene

var i
var vElements = document.getElementsByClassName("video")
for (i = 0; i < vElements.length; i++) {vElements[i]. innerHTML = '';} 

My question was more a c. choice.

I have 9 videos on youtube, but when I put 9 html widgets with iframe inside, it takes to much time to load.

So my idea was to prepare a first scene with the 9 pictures only and 9 scenes with the videos.

Exemple :
-the scene 1 contain the video 1 and the other 8 pictures…
-the scene 2 contain the video 2 and the other 8 pictures…

All the video are on autoload mode, but when you leave a scene to see another video (yes switching), I would like to stop it.

First Hype was done to make things without code, isn’t it ?

Thank you for your answers,

Pascal

setting the innerHTML of the videocontainer to ‘’ is the easiest way to go … so take it :slight_smile:

You mean this code on unload scene ?

var emptyInnerHTML = ‘’;
hypeDocument.getElementById(“video1”).innerHTML = emptyInnerHTML

It works !
Thank you my friends

where do I put this code ? in the header ? do attribute video class to every videos in the web site ?
I have vimeo and Youtube video included.
Thank you all !