HTML5视频currentTime在Chrome中无效

时间:2016-11-02 22:07:35

标签: javascript html5 google-chrome

我正在尝试创建自己的HTML5视频播放器,我正在使用此代码更改视频的当前时间:

$(document).ready(function(){

           ...

//controls.total is my seekbar

controls.total.click(function(e) {
        var x = e.pageX;
        var prog = $(this);
        var maxduration = video.duration;
        var position = x - prog.offset().left;
        var percentage = 100 * position / prog.width();
        if(percentage > 100) {
            percentage = 100;
        }
        if(percentage < 0) {
            percentage = 0;
        }
        controls.progress.css('width',percentage+'%');
        if ( video.seekable.length > 0 ) {
            video.currentTime = maxduration * percentage / 100;
        }
    });

           ...

}

它在IE9,Edge和Firefox中的工作方式正常。但它在Chrome中不起作用。它只是将currentTime设置为0.为什么?

0 个答案:

没有答案
相关问题