我使用以下代码创建iframeyoutubevidéo:
var tag = document.createElement('script');
tag.src = "//www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
// ...
_yt_player = new YT.Player("#myobjectytiframe", {
height : 640,
width : 480,
videoId : video_id,
events : {
'onReady': function(){
_yt_player.playVideo();
// ENABLE FULLSCREEN
},
'onStateChange': function(){},
'onError': function(){}
}
});
我想在onReady
回调中启用全屏,怎么做?
答案 0 :(得分:0)
尝试使用html5 api:
document.fullScreen;
node.requestFullScreen();
document.cancelFullScreen();