javascript - Stop embedded youtube iframe? -
i'm using youtube iframe embed videos on site.
<iframe width="100%" height="443" class="yvideo" id="p1qgnf6j1h0" src="http://www.youtube.com/embed/p1qgnf6j1h0?rel=0&controls=0&hd=1&showinfo=0&enablejsapi=1" frameborder="0" allowfullscreen> </iframe> and have multiplie videos on same page.
i want stop of them or 1 of them in click of button using javascript or so.
is possible?
update:
i tried talvi watia said , used:
$('#mystopclickbutton').click(function(){ $('.yvideo').each(function(){ $(this).stopvideo(); }); }); i'm getting:
uncaught typeerror: object [object object] has no method 'stopvideo'
you may want review through youtube javascript api reference docs.
when embed video(s) on page, need pass parameter:
http://www.youtube.com/v/video_id?version=3&enablejsapi=1 if want stop videos button, can setup javascript routine loop through videos , stop them:
player.stopvideo() this involve keeping track of page ids each video on page. simpler might make class , use jquery.each.
$('#mystopclickbutton').click(function(){ $('.myvideoclass').each(function(){ $(this).stopvideo(); }); });
Comments
Post a Comment