gpt4 book ai didi

javascript - jQuery:无控件

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

我如何摆脱YouTube播放器上的所有控件,以便在加载所有内容后,只需单击视频即可暂停播放。为了帮助理解我的意思:https://www.kanyewest.com/完全像这样。如果您不确定我的意思,请发表评论

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

<script src="http://www.youtube.com/player_api"></script>

// create youtube player
var player;
function onYouTubePlayerAPIReady() {
player = new YT.Player('player', {
height: '1000',
width: '1905',
videoId: 'a5SMyfbWYyE',
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
}

// autoplay video
function onPlayerReady(event) {
event.target.playVideo();
}

// when video ends
function onPlayerStateChange(event) {
if(event.data === 0) {
alert('done');
}
}

最佳答案

您可以在传递给playerVars的对象上包含YT.Player属性。在playerVars对象上,您需要将controls属性设置为零。

这是我在最近的项目中所做的工作:

Code

App

  //Instantiate new YouTube player after iFrame API has loaded
$window.onYouTubeIframeAPIReady = function() {
this.player = new YT.Player('player', {
height: '360',
width: '640',
playerVars: {
'autohide': 1,
'modestbranding': 1,
'controls': 0,
'iv_load_policy': 3,
'showinfo': 0,
'rel': 0,
'color': 'white'
},
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
}

相关文件:

YouTube Embedded Players and Player Parameters

Controls parameter

关于javascript - jQuery:无控件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39002829/

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