I have a list of iframe videos in my webpage.
<iframe width="520" height="360" src="http://www.youtube.com/embed/2muxrT5_a6E" frameborder="0" allowfullscreen></iframe>
<iframe width="520" height="360" src="http://www.youtube.com/embed/2muxrT5_a6E" frameborder="0" allowfullscreen></iframe>
<iframe width="520" height="360" src="http://www.youtube.com/embed/2muxrT5_a6E" frameborder="0" allowfullscreen></iframe>
<a href="#" class="close">Stop all videos</a>
I need to stop all playing iframe videos on click the link Stop all videos
. How can i do that?
You can modify this code with an iteration
OWNER: https://gist.github.com/cferdinandi/9044694 also posted here (by me): how to destroy bootstrap modal window completely?
Reloading all iframes just to stop them is a terrible idea. You should get advantage what comes with HTML5.
Without using YouTube's iframe_API library; you can simply use:
which will stop all youtubes iframe videos.
You can use these message keywords to start/stop/pause youtube embdded videos:
Check out the link below for the live demo:
Try this way,
Stopping means pausing and setting the video to time 0:
This jquery code will do exactly that.
No need to replace the src attribute and reload the video again.
Little function that I am using in my project:
I edited the above code a little and the following worked for me.......
Reload all iframes again to stop videos