YouTube API不支持IE9中的循环吗?

时间:2015-02-11 22:27:28

标签: javascript youtube

所以我将背景视频粘贴到我们的网页上,我有以下代码:

function setupYoutubeBG(videoId){
    var tag = document.createElement('script');
    tag.src = "https://www.youtube.com/player_api";
    var firstScriptTag = document.getElementsByTagName('script')[0];
    firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

    // , This function creates an <iframe> (and YouTube player)
    //    after the API code downloads.
    var player;
    window.onYouTubePlayerAPIReady = function() {
        player = new YT.Player('bgPlayer', {

            playerVars: { 'autoplay': 1, 'controls': 0,'autohide':1, 'wmode':'opaque', 'playlist':videoId, 'loop':1 },
            videoId: videoId,
            events: {
                'onReady': onPlayerReady}
        });
    }

    // The API will call this function when the video player is ready.
    function onPlayerReady(event) {
        event.target.mute();
    }
}

这非常简单,从文档中提取。适用于包括IE11在内的所有浏览器,但出于某种原因,在IE9中进行测试时,视频无法循环播放。我已将播放列表设置为videoId,就像我说的那样,它可以在其他任何地方使用。如果有人有想法或能指出我正确的方向,我们将不胜感激。

0 个答案:

没有答案