HTML5 Video - Chrome - Error settings currentTime

こ雲淡風輕ζ 提交于 2019-12-21 14:14:12

问题


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??


回答1:


Try something like this (JS):

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

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



回答2:


As far as I understood an automatic solution is not possible on the iPad, since the user has to click either the poster or the movie according to Apple's documentation.




回答3:


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;
          }
     }
}



回答4:


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




回答5:


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

with coffeescript & jQuery



来源:https://stackoverflow.com/questions/3165444/html5-video-chrome-error-settings-currenttime

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!