2016-12-30 170 views
0

如何停止YouTube视频加载,一旦我暂停它?如何停止加载嵌入的YouTube视频后,暂停它

一旦我暂停视频,在视频加载进度条也应该停止。

<iframe width="560" height="315" src="https://www.youtube.com/embed/Ggh_y-33Eso" frameborder="0" allowfullscreen></iframe> 
+1

刷新iframe的来源,虽然这是不好的,或者您使用iframe中这样使用iframe API –

+0

? http://codepen.io/anon/pen/VmogpK – 0x736a64

+0

是我使用的iframe仅 – user7357089

回答

0
You may want to review through the Youtube JavaScript API Reference docs. 

When you embed your video(s) on the page, you will need to pass this parameter: 

http://www.youtube.com/v/VIDEO_ID?version=3&enablejsapi=1 
If you want a stop all videos button, you can setup a javascript routine to loop through your videos and stop them: 

player.stopVideo() 
This does involve keeping track of all the page IDs for each video on the page. Even simpler might be to make a class and then use jQuery.each. 

$('#myStopClickButton').click(function(){ 
    $('.myVideoClass').each(function(){ 
    $(this).stopVideo(); 
    }); 
}); 
+0

我不明白,我想停止加载时,我暂停YouTube视频嵌入视频 – user7357089

相关问题