【问题标题】:Pause youtube video Through Javascript通过 Javascript 暂停 youtube 视频
【发布时间】:2017-04-13 09:23:37
【问题描述】:
我在对象标签中打开了 Youtube 视频网址
<object data="https://www.youtube.com/embed/a18py61_F_w?wmode=opaque&rel=0&autohide=1&showinfo=0&wmode=transparent" style="width:100%;height:100%;width: 380px; height: 214px; float: none; clear: both; margin: 2px auto;"> </object>
我想通过使用代码 javascript 代码或 jquery 代码来停止视频。
注意:我不能使用 iframe
任何帮助都会被应用。
【问题讨论】:
标签:
javascript
jquery
youtube
【解决方案1】:
<embed id="playerid" width="100%" height="100%" allowfullscreen="true" allowscriptaccess="always" quality="high" bgcolor="#000000" name="playerid" style="" src="https://www.youtube.com/embed/a18py61_F_w?wmode=opaque&rel=0&autohide=1&showinfo=0&wmode=transparent" style="width:100%;height:100%;width: 380px; height: 214px; float: none; clear: both; margin: 2px auto;" type="application/x-shockwave-flash">
<a href="#" onclick="var myPlayer = document.getElementById('playerid'); myPlayer.pauseVideo();">Pause</a>