html5 video mp4标签中的currentTime

推荐这篇日记的豆列
······下次自动登录
现在的位置:
& 综合 & 正文
HTML5 解决video设置currentTime 报错chrome中INVALID_STATE_ERR
今天用到了video标签,想让视频播放跳到指定位置,可是一直报错INVALID_STATE_ERR,
var v= Ext.getDom("example_video_1");
v.currentTime=10;
三者的值均为时间,单位为秒,currentTime为可读写属性,其余两个均为只读属性。
使用media.currentTime返回当前媒介的播放位置,或者对其赋值,改变媒介的播放位置。
对于使用media.currentTime的时候,如果返回的时间超出了浏览器的请求能力,将抛出一个INDEX_SIZE_ERR异常;如果没有选中的媒体资源,将抛出一个INVALID_STATE_ERR异常。
使用media.startTime返回媒介文件播放的开始时间,通常为0。
使用media.duration返回媒介文件总的播放时长。
var v= Ext.getDom("example_video_1");
Ext.fly("example_video_1").on("canplaythrough",function(){
v.currentTime=10;
原因是video的资源改变了src后还没来得及加载就设置currentTime,而报错,
所以添加事件在video加载完成可以播放后,再设置
&&&&推荐文章:
【上篇】【下篇】Your user agent does not support the HTML5 Video element.
currentTime+=10
currentTime-=10
currentTime=50
playbackRate++
playbackRate--
playbackRate+=0.1
playbackRate-=0.1
volume+=0.1
volume-=0.1
muted=true
muted=false
Sintel teaser
Bunny trailer
Bunny movie
Test movie
Media Events
Media Properties
MediaController Events
MediaController Properties
canPlayType
Limitations
Some events may be fired despite the lack of effect on the video itself,
in particular while trying to chan
Not all conditions are necessarily there to generate every single
possible event, such as stalled or emptied;
The rendered page may not be updated while the video is
playing. Thus you may see plenty of timeupdate
events counted after the video is paused/
plh@w3.org - November 2014
Many, many thanks to the
and the community around the .}

我要回帖

更多关于 html5 video mp4 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信