HTML5视频播放器进度栏更新 [英] HTML5 Video Player Progress Bar Update

查看:127
本文介绍了HTML5视频播放器进度栏更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在关注newboston的HTML5视频教程,并到达了制作视频播放器的教程。我已经完全复制了代码,但是单击进度条不会更新。

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.

我的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!

编辑:固定链接。

推荐答案

您的代码正在有效更改

 bar.addEventListener('click', **clickedbar**, false);
 bar.addEventListener('click', clickedBar, false);

http://jsfiddle.net/wqr7S/4/

这篇关于HTML5视频播放器进度栏更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆