如何禁用YouTube播放器

时间:2014-01-07 09:52:59

标签: javascript youtube youtube-api

我使用此代码在我的网站上运行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
       }
    });

0 个答案:

没有答案