Stop embedded youtube iframe?(停止嵌入 youtube iframe?)
问题描述
我正在使用 YouTube iframe 在我的网站上嵌入视频.
I'm using YouTube iframe to embed videos on my site.
我在同一页面上有多个视频.
And i have multiplie videos on the same page.
我想使用 javascript 左右单击一个按钮来停止所有这些或其中一个.
I want to stop all of them or one of them in a click of a button using javascript or so.
有可能吗?
我尝试了 Talvi Watia 所说和使用的方法:
I tried what Talvi Watia said and used:
我明白了:
推荐答案
您可能需要通过 Youtube JavaScript API 进行审核 参考文档.
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:
如果您想要停止所有视频按钮,您可以设置一个 javascript 例程来循环播放视频并停止它们:
If you want a stop all videos button, you can setup a javascript routine to loop through your videos and stop them:
这确实涉及跟踪页面上每个视频的所有页面 ID.更简单的可能是创建一个类,然后使用 jQuery.each.
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.
这篇关于停止嵌入 youtube iframe?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!