5

当我尝试在 Chrome 5.0.375.86 中设置 HTML5 Video 元素的 currentTime 时,例如:

video.currentTime = 1.0;

我收到以下 javascript 异常:

Uncaught Error: INDEX_SIZE_ERR: DOM Exception 1

它在 Safari 中运行良好。有没有人经历过这个??

4

5 回答 5

5

尝试这样的事情(JS):

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

function init()
{
    video.addEventListener('loadedmetadata', loadStart, false);
}
document.addEventListener("DOMContentLoaded", init, false);
于 2010-09-13T06:18:47.013 回答
0

这对我有用

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;
          }
     }
}
于 2014-08-26T10:08:40.700 回答
0

据我了解,iPad 上不可能有自动解决方案,因为根据 Apple 的文档,用户必须点击海报或电影。

于 2011-08-05T07:27:13.517 回答
0

问题(至少关于 Chrome)可能出在服务器端。把Header set Accept-Ranges bytes你的.htaccess(这个这个答案

于 2015-08-13T14:00:21.703 回答
-2
$video.on 'loadedmetadata', ->
            $video[0].currentTime = parseInt(options.history)

使用咖啡脚本和 jQuery

于 2013-01-15T03:57:19.573 回答