gpt4 book ai didi

jquery - 停止iframe YouTube视频

转载 作者:行者123 更新时间:2023-12-03 06:03:06 25 4
gpt4 key购买 nike

我有一个嵌入式的你管视频

<iframe width="490" height="279" src="http://www.youtube.com/embed/X7ab_dVhkWk?version=3&enablejsapi=1" frameborder="0" allowfullscreen></iframe>

嵌入时的html
<embed width="100%" height="100%" id="video-player-flash" type="application/x-shockwave-flash" src="http://s.ytimg.com/yt/swfbin/watch_as3-vflCBBX6J.swf" allowscriptaccess="always" allowfullscreen="true" bgcolor="#000000" flashvars="el=embedded&amp;fexp=904544%2C909703%2C920701&amp;is_html5_mobile_device=false&amp;allow_ratings=1&amp;allow_embed=1&amp;tabsb=1&amp;sendtmp=1&amp;hl=en_US&amp;eurl=http%3A%2F%2Fdev.springcorp.co.uk%2Fhistoricscotland%2Fstirling%2Ffacebook-april2012%2F&amp;iurl=http%3A%2F%2Fi2.ytimg.com%2Fvi%2Fai55pL37saU%2Fhqdefault.jpg&amp;view_count=117&amp;title=Regent%20Arran%20Stirling%20Castle%20TV%20ad%202012&amp;avg_rating=0&amp;video_id=ai55pL37saU&amp;length_seconds=31&amp;iurlmaxres=http%3A%2F%2Fi2.ytimg.com%2Fvi%2Fai55pL37saU%2Fmaxresdefault.jpg&amp;enablejsapi=1&amp;sk=UX8fbMJpKT-VH3IVkWhtN7gCKU1r3TSzC&amp;rel=1&amp;playlist_module=http%3A%2F%2Fs.ytimg.com%2Fyt%2Fswfbin%2Fplaylist_module-vflfGS7wE.swf&amp;iurlsd=http%3A%2F%2Fi2.ytimg.com%2Fvi%2Fai55pL37saU%2Fsddefault.jpg&amp;jsapicallback=ytPlayerOnYouTubePlayerReady&amp;playerapiid=player1&amp;framer=http%3A%2F%2Fdev.springcorp.co.uk%2Fhistoricscotland%2Fstirling%2Ffacebook-april2012%2F">

如何使用Javacript停止该vid?

最佳答案

最后,我不得不使用api进行嵌入,因此我引用了vid。 (xxxx是视频的youtube ID)

<div id="player"></div>
<div id="player2"></div>
<div id="player3"></div>

<script>
//Load player api asynchronously.
var tag = document.createElement('script');
tag.src = "http://www.youtube.com/player_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var done = false;
var player;
var player2;
var player3;
function onYouTubePlayerAPIReady() {
player = new YT.Player('player', {
height: '279',
width: '490',
videoId: 'xxxxxxxx',

});

player2 = new YT.Player('player2', {
height: '279',
width: '490',
videoId: 'xxxxxxx',

});

player3 = new YT.Player('player3', {
height: '279',
width: '490',
videoId: 'xxxxxx',

});
}

function stopVideo() {
player.stopVideo();

}

关于jquery - 停止iframe YouTube视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10347330/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com