video标签在播放视频时的各种状态
2011-05-18 18:50
375 查看
On Mon, 18 Oct 2010 01:01:00 +0200, Chris Pearce <chris@pearce.org.nz> wrote:
In the description of the media ready states for HAVE_ENOUGH_DATA [1],
the spec says:
If the autoplaying flag
<http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#autoplaying-flag>
is true, and the |paused
<http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#dom-media-paused>|
attribute is true, and the media element
<http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#media-element>
has an |autoplay
<http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#attr-media-autoplay>|
attribute specified, and the media element
<http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#media-element>
is in a |Document
<http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#document>|
whose browsing context
<http://www.whatwg.org/specs/web-apps/current-work/multipage/browsers.html#browsing-context>
did not have the sandboxed automatic features browsing context flag
<http://www.whatwg.org/specs/web-apps/current-work/multipage/the-iframe-element.html#sandboxed-automatic-features-browsing-context-flag>
set when the |Document
<http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#document>|
was created, then the user agent may also set the |paused
<http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#dom-media-paused>|
attribute to false, queue a task
<http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#queue-a-task>
to fire a simple event
<http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#fire-a-simple-event>
named |play
<http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#event-media-play>|,
and queue a task
<http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#queue-a-task>
to fire a simple event
<http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#fire-a-simple-event>
named |playing
<http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#event-media-playing>|.
This means that we'll will only autoplay if a media element is in a
document. Why do we prevent media elements not in a document from
autoplaying? We allow audio from a media element not in a document to
play, why not allow autoplay to work while not in a document too?
I note that Firefox, Chrome, Safari and Opera all autoplay when a media
element is not in a document. It looks like IE9 Beta never autoplays
unless the media element is hard coded in the HTML file with an autoplay
attribute; IE9 doesn't seem to honour autoplay set from script.
Unless there's a good reason not to, and since most browsers have
implemented autoplay when not in a document anyway, perhaps we should
update the spec to match the implemented behaviour?
Regards,
Chris Pearce.
[1]
http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#dom-media-have_enough_data
Subversion is too slow to say exactly when, but "and the media element is in a Document whose browsing context did not have the sandboxed automatic features browsing context flag set when the Document was created" was added to the spec quite recently, after Opera implemented autoplay anyway.
Assuming the change in behavior was accidental, the spec should instead say "and the media element is not in a Document whose browsing context had the sandboxed automatic features browsing context flag set when the Document was created".
--
Philip Jägenstedt
Core Developer
Opera Software
In the description of the media ready states for HAVE_ENOUGH_DATA [1],
the spec says:
If the autoplaying flag
<http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#autoplaying-flag>
is true, and the |paused
<http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#dom-media-paused>|
attribute is true, and the media element
<http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#media-element>
has an |autoplay
<http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#attr-media-autoplay>|
attribute specified, and the media element
<http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#media-element>
is in a |Document
<http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#document>|
whose browsing context
<http://www.whatwg.org/specs/web-apps/current-work/multipage/browsers.html#browsing-context>
did not have the sandboxed automatic features browsing context flag
<http://www.whatwg.org/specs/web-apps/current-work/multipage/the-iframe-element.html#sandboxed-automatic-features-browsing-context-flag>
set when the |Document
<http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#document>|
was created, then the user agent may also set the |paused
<http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#dom-media-paused>|
attribute to false, queue a task
<http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#queue-a-task>
to fire a simple event
<http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#fire-a-simple-event>
named |play
<http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#event-media-play>|,
and queue a task
<http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#queue-a-task>
to fire a simple event
<http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#fire-a-simple-event>
named |playing
<http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#event-media-playing>|.
This means that we'll will only autoplay if a media element is in a
document. Why do we prevent media elements not in a document from
autoplaying? We allow audio from a media element not in a document to
play, why not allow autoplay to work while not in a document too?
I note that Firefox, Chrome, Safari and Opera all autoplay when a media
element is not in a document. It looks like IE9 Beta never autoplays
unless the media element is hard coded in the HTML file with an autoplay
attribute; IE9 doesn't seem to honour autoplay set from script.
Unless there's a good reason not to, and since most browsers have
implemented autoplay when not in a document anyway, perhaps we should
update the spec to match the implemented behaviour?
Regards,
Chris Pearce.
[1]
http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#dom-media-have_enough_data
Subversion is too slow to say exactly when, but "and the media element is in a Document whose browsing context did not have the sandboxed automatic features browsing context flag set when the Document was created" was added to the spec quite recently, after Opera implemented autoplay anyway.
Assuming the change in behavior was accidental, the spec should instead say "and the media element is not in a Document whose browsing context had the sandboxed automatic features browsing context flag set when the Document was created".
--
Philip Jägenstedt
Core Developer
Opera Software
相关文章推荐
- embed标签的使用(在网页中播放各种音频视频的插件的使用)
- 低版本IE6/7/8浏览器中使用HTML5的audio和video标签播放视频音频
- 验证是否支持html5的Video标签及MP4视频播放
- HTML5添加video视频标签后仍然无法播放的解决方法
- embed标签的使用(在网页中播放各种音频视频的插件的使用)
- 前端视频播放初探总结,video标签-视频插件jwplayer
- HTML5 audio与video标签实现视频播放,音频播放
- HTML5添加 video 视频标签后仍然无法播放的解决方法 IIS添加MIEI类型
- html5的video标签插入mp4视频放在iis服务器访问无法播放解决方案
- video标签播放视频,有声音无图像的解决办法
- embed标签的使用(在网页中播放各种音频视频的插件的使用)
- 视频播放- video标签
- video标签播放视频
- HTML5-video标签-实现点击预览图播放或暂停视频
- 解决三星等设备video标签播放hls视频时候只有声音没有视频。。。
- Android HTML5 Video视频标签自动播放与自动全屏问题解决
- js控制html5 【video】标签中视频的播放和停止
- ios下video标签无法播放视频
- 验证是否支持html5的Video标签及MP4视频播放
- JCVideoPlayer朋友圈动态多item视频播放以及使用compile 'fm.jiecao:jiecaovideoplayer:5.5.2'版本在项目中出现的各种异常处理