function onYouTubeIframeAPIReady() {
alert("onYouTubeIframeAPIReady Fired"); //This works
player = new YT.Player('player', {
//height: '390',
//width: '640',
videoId: buni_php_params.videoId,
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
}
// 4. The API will call this function when the video player is ready.
function onPlayerReady(event) {
alert("onPlayerReady Fired"); // This doesn't
event.target.playVideo();
}
视频加载并播放。
http://wppagoda.pagodabox.com/?p=1
我为我正在制作的插件安装了标准的 wordpress,它从数据库 ( buni_php_params.videoId
) 中获取一个 videoID 并播放它。但是 onPlayerReady 事件永远不会被触发……即使onYouTubeIframeAPIReady
被触发了。