简体   繁体   中英

HTML5 Video - Chrome - Error settings currentTime

When I try to set the currentTime of the HTML5 Video element in Chrome 5.0.375.86 like:

video.currentTime = 1.0;

I am getting the following javascript exception:

Uncaught Error: INDEX_SIZE_ERR: DOM Exception 1

It works fine in Safari. Has anybody experienced this??

Try something like this (JS):

function loadStart(event)
{
    video.currentTime = 1.0;
}

function init()
{
    video.addEventListener('loadedmetadata', loadStart, false);
}
document.addEventListener("DOMContentLoaded", init, false);

this is work for me

video = document.getElementById('video');
begin_play  = 50;
play_video_frist = true; //if you want to run only frist time    
video.addEventListener("play", capture, false);

function capture(event) 
{
     if (event.type == "play"){
         if(play_video_frist){
             play_video_frist = false;
             video.currentTime = begin_play;
          }
     }
}

The problem (at least regarding Chrome) is probably on the server side. Put Header set Accept-Ranges bytes in your .htaccess (this this answer )

据我所知,iPad上无法实现自动解决方案,因为用户必须根据Apple的文档点击海报或电影。

$video.on 'loadedmetadata', ->
            $video[0].currentTime = parseInt(options.history)

with coffeescript & jQuery

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM