onYouTubePlayerReady在使用swfobject加载后未被调用

时间:2013-11-27 02:08:56

标签: javascript youtube-javascript-api

我做错了什么? YouTube播放器会替换#player元素,但永远不会调用onYouTubePlayerReady

window.onYouTubePlayerReady = function() {
    alert('success!');
    console.log('yt player loaded!', arguments);
}

window.onload = function () {
    swfobject.embedSWF('http://www.youtube.com/v/S57AWoY6zDQ?version=3&enablejsapi=1',
    'player', 800, 600, '8', null, null, 
    { allowScriptAccess: true }, { id: 'myYTplayer' });
};

实时代码:http://jsfiddle.net/patricklorio/GyMN5/

1 个答案:

答案 0 :(得分:0)

{ allowScriptAccess: true }应为{ allowScriptAccess: 'always' }