H5 video安卓默认点击不能全屏播放解决办法
调用方法:
autoFullScrenn(obj)
还有一篇:
使用MediaElement.js构建个性的HTML5音频和视频播放器
var fullscreen = function(elem) { var prefix = 'webkit'; if ( elem[prefix + 'EnterFullScreen'] ) { return prefix + 'EnterFullScreen'; } else if( elem[prefix + 'RequestFullScreen'] ) { return prefix + 'RequestFullScreen'; }; return false; }; function autoFullScrenn(v){ var ua = navigator.userAgent.toLowerCase(); var Android = String(ua.match(/android/i)) == "android"; // if(!Android) return;//非android系统不使用; var video = v,doc = document; var fullscreenvideo = fullscreen(doc.createElement("video")); if(!fullscreen) { alert("不支持全屏模式"); return; } video.addEventListener("webkitfullscreenchange",function(e){ if(!doc.webkitIsFullScreen){//退出全屏暂停视频 this.pause(); // this.pause(); }; }, false); video.addEventListener("click", function(){ this.play(); video[fullscreenvideo](); }, false); video.addEventListener('ended',function(){ doc.webkitCancelFullScreen(); //播放完毕自动退出全屏 },false); }; // autoFullScrenn(video_obj)