有没有办法使HTML5视频全屏? [英] Is there a way to make HTML5 video fullscreen?
问题描述
有没有办法使用HTML5 < video>
标签来播放全屏视频? 以及
如果这是不可能的,是否有人知道是否有这个决定的理由? 解决方案
HTML 5没有办法全屏视频,但平行的全屏规范提供 requestFullScreen
方法,它允许任意元素(包括< video>
元素)全屏显示。
它在许多浏览器上提供了实验支持。
原始答案:
从 HTML5规范(撰写本文时:2009年6月):
用户代理不应该提供
publ ic API使视频显示
全屏。一个脚本与一个
精心制作的视频文件结合在一起,
可以诱使用户认为已经显示
系统模式对话框,
并提示用户输入密码。
此外还存在单纯
烦恼的危险,当链接点击
或浏览页面时,页面将启动
全屏视频。相反,可以提供
特定于用户代理的界面特征
以轻松地允许
用户获得全屏播放
模式。
浏览器可能会提供一个用户界面,但不应该提供可编程的界面。
请注意,上述警告已从规范中删除。
Is there a way to play a video fullscreen using the HTML5 <video>
tag?
And if this is not possible, does anybody know if there is a reason for this decision?
HTML 5 provides no way to make a video fullscreen, but the parallel Fullscreen specification supplies the requestFullScreen
method which allows arbitrary elements (including <video>
elements) to be made fullscreen.
It has experimental support in a number of browsers.
Original answer:
From the HTML5 spec (at the time of writing: June '09):
User agents should not provide a public API to cause videos to be shown full-screen. A script, combined with a carefully crafted video file, could trick the user into thinking a system-modal dialog had been shown, and prompt the user for a password. There is also the danger of "mere" annoyance, with pages launching full-screen videos when links are clicked or pages navigated. Instead, user-agent specific interface features may be provided to easily allow the user to obtain a full-screen playback mode.
Browsers may provide a user interface, but shouldn't provide a programmable one.
Note that the above warning has since been removed from the specification.
这篇关于有没有办法使HTML5视频全屏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!