admin管理员组文章数量:1316339
I've been following thenewboston's HTML5 video tutorial and have reached the tutorials where we make the video player. I've copied the code exactly but the progress bar doesn't update when it is clicked.
My JSFiddle
I think the reason this isn't working is because of something wrong with:
function clickedBar(e){
if(!myMovie.paused && !myMovie.ended){
var mouseX=e.offsetX;
var newtime=mouseX*myMovie.duration/barSize;
myMovie.currentTime=newtime;
progressBar.style.width=mouseX+'px';
}
}
I really can't figure out why it's not working but any help will be appreciated!
EDIT: Fixed Link.
I've been following thenewboston's HTML5 video tutorial and have reached the tutorials where we make the video player. I've copied the code exactly but the progress bar doesn't update when it is clicked.
My JSFiddle
I think the reason this isn't working is because of something wrong with:
function clickedBar(e){
if(!myMovie.paused && !myMovie.ended){
var mouseX=e.offsetX;
var newtime=mouseX*myMovie.duration/barSize;
myMovie.currentTime=newtime;
progressBar.style.width=mouseX+'px';
}
}
I really can't figure out why it's not working but any help will be appreciated!
EDIT: Fixed Link.
Share Improve this question asked May 27, 2014 at 8:48 Luke-TLuke-T 451 gold badge1 silver badge7 bronze badges 2-
change
e
toevent
– ashishmaurya Commented May 27, 2014 at 8:50 - no difference. was there any particular reason for this? – Luke-T Commented May 27, 2014 at 8:52
1 Answer
Reset to default 4your code is working change
bar.addEventListener('click', **clickedbar**, false);
bar.addEventListener('click', clickedBar, false);
http://jsfiddle/wqr7S/4/
本文标签: javascriptHTML5 Video Player Progress Bar UpdateStack Overflow
版权声明:本文标题:javascript - HTML5 Video Player Progress Bar Update - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742002389a2411275.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论