我的工作区在这里:http: //jsfiddle.net/WBFa4/89/ 我正在尝试检测视频的结尾以加载下一个视频。永远不会触发 onStateChange 事件。可能是什么问题?
swfobject.embedSWF
(
'http://www.youtube.com/apiplayer?enablejsapi=1&version=3',
'ytplayer_div1',
'425',
'344',
'8',
null,
null,
{
allowScriptAccess: 'always',
allowFullScreen: 'true'
},
{
id: 'ytplayer_object'
}
);
onYouTubePlayerReady = function() {
var ytplayer = document.getElementById("ytplayer_object");
addEventListener("onStateChange","handlestatechange");
ytplayer.loadVideoById("V2AshX3tfHU", 5, "large");
}
function handlestatechange(state) {
if(state==0) {
ytplayer.loadVideoById("bHQqvYy5KYo");
}
}