1

我正在尝试在我的网站上运行 YT 播放器,但 IE8 和 IE9 存在问题 - 播放器未加载。 http://code.google.com/intl/pl/apis/youtube/youtube_player_demo.html

代码:

$(document).ready(function() {
    loadPlayer('{$videos[0].videoID}','{$playlist}');
}

function onYouTubePlayerReady(playerId) {
    ytplayer = document.getElementById("ytPlayer");
    ytplayer.addEventListener("onError", "onPlayerError");
    ytplayer.addEventListener("onStateChange", 'onStateChange');
}

function loadPlayer(ytID,ytList) {
    var videoID = ytID;
    var params = {
        allowScriptAccess: "always",
        allowFullScreen: true
    };
    var atts = {
        id: "ytPlayer"
    };
    swfobject.embedSWF("http://www.youtube.com/v/" + videoID +
        "?version=3&enablejsapi=1&playerapiid=player1&autohide=1&showinfo=0&autoplay=1&controls=1&loop=1&fs=1&origin=http://www._____.com&playlist="+ytList+'&key='+devKey,
        "videoDiv", "620", "350", "9", null, null, params, atts);
}
4

2 回答 2

0

I don't know if this causes the problem (shouldn't work on any environment), but there's a syntax error on line 3:

}

You're not closing the ready(), should be:

});
于 2012-02-01T16:28:41.087 回答
0

IE 不支持 addEventListener 方法。尝试重新工作。

于 2013-03-04T20:06:36.193 回答