html 5视频,当用户进入当前网页时自动以全屏模式打开
html 5 video to automatically open in fullscreen mode when user enter the current webpage
- 首先,我创建了一个网页,在这个网页中有一个链接到的按钮html5视频播放器页面(这是另一个页面(
- 然后,我想实现当点击按钮时页面(html5视频播放器页面(可以自动全屏显示。
我希望它在IPhone中运行
我尝试使用代码
window.load=function(){
myVideo=document.getElementById('video')[0];
if(!myVideo.webkitDisplayingFullscreen){
goFullscreen();
}
function goFullScreen(){ myVideo.webkitEnterFullscreen();}
}
铬说:未捕获的InvalidStateError:无法执行"webkitEnterFullscreen"在"HTMLVideoElement"上:此元素只能在中进入全屏模式对用户手势的响应
那么有没有其他的解决方案可以自动进入全屏模式呢??
你可以像我的例子一样,制作一个视频作为页面的背景,检查fiddle
http://jsfiddle.net/N4Lbp/4/
全屏显示:https://jsfiddle.net/N4Lbp/4/embedded/result/
HTML:
<video autoplay loop poster="http://peach.blender.org/wp-content/uploads/bbb-splash.png" id="video_bg">
<source src="http://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_stereo.ogg" type="video/ogg">
<source src="http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4" type="video/mp4">
</video>
CSS:
*, *:after, *:before {
box-sizing: border-box;
-moz-box-sizing: border-box;
}
html, body {
height: 100%;
}
#video_bg {
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
position: fixed;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
z-index: -100;
background: url(http://peach.blender.org/wp-content/uploads/bbb-splash.png) no-repeat;
background-size: cover;
}
相关文章:
- Javascript,访问一个主要对象模块模式中的每个对象
- 是否有任何snippet或jQuery插件可以列出easylist.txt模式匹配的DOM中的所有元素
- 试图在引导模式内动态生成图表,得到offsetWidth错误
- 同位素库错误:未捕获错误无布局模式包装生产线8
- 如何防止网页加载后自动启动功能
- 在DOM中查找一个模式并替换它's的内容使用jquery
- Firefox:从网页强制全屏模式
- 如何在网页中显示模式对话框
- 如何在全屏模式下自动打开网页
- 如何在正文加载时以全屏模式(F11 功能)打开网页
- 从其他网页打开模式网页
- 在html/网页中实现编辑和审阅模式
- 如何判断网页是否在chrome应用程序快捷模式下运行
- 如何在离线模式下存储修改后的网页内容,然后再回到在线状态
- 自容器可关闭的全屏模式覆盖现有网页
- html 5视频,当用户进入当前网页时自动以全屏模式打开
- 网页应用程序在Ipod上的全屏模式
- 按照一定的模式扫描dom/网页,得到domtag
- 网页设计中的颜色燃烧混合模式
- 使用按钮单击打开的 jQuery UI 模式未加载网页