我使用此代码在我的网站上运行YouTube视频,
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var done = false;
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player('player', {
height: '390',
width: '640',
videoId: "video id",
playerVars: {rel: 0},
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
}
使用事物代码我可以跟踪Youtube视频数据但如何使用youtube api禁用视频,我搜索这样的代码(这是错误的)
player = new YT.Player('player', {
height: '390',
**disable: true,**
width: '640',
videoId: "video id",
playerVars: {rel: 0},
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});