onYouTubePlayerReady回调未触发

时间:2013-10-07 12:36:09

标签: javascript youtube callback

根据documentation

调用带有网址http://www.youtube.com/v/VIDEO_ID?version=3&enablejsapi=1的嵌入应该在视频准备就绪时触发onYouTubePlayerReady()的回调。我试图像这样实现:

<body>
<iframe id="ytplayer" type="text/html" width="100%" height="56.25"
                src="http://www.youtube.com/v/M7lc1UVf-VE?version=3&enablejsapi=1&playerapiid=ytplayer"
                frameborder="0" allowfullscreen></iframe>
</body>

使用Javascript:

function onYouTubePlayerReady(playerID){
    console.log(playerID);
    console.log('working');
    alert('working');
}

但是没有触发回调,请参阅js-fiddle:我做错了什么?

http://jsfiddle.net/B85p5/1/

0 个答案:

没有答案