views:

520

answers:

5

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

A: 

same problem here and it drives me crazy.

when i step over my javascript-code in debug mode (chrome 5.0.375.99) there seems to be no problem and everything works fine.

But when i load the page without debugger i get the same exception? I found this page: http://www.annodex.net/~silvia/itext/mediafrag.html#t=50. everything works fine there.

Whats the problem???

derHendrik
found out another fact: works fine on a click function. But not on page initialization.
derHendrik
A: 

I'm running into the problem as well. I'm using "mp4" video container with H264 video and AAC audio codecs.

A hint is that vid.seekable.length==1 on Safari, but ==0 on Chrome. See www.w3.org/TR/html5/video.html#dom-media-seekable for spec details.

Might also be related to this issue: http://code.google.com/p/chromium/issues/detail?id=48722 which seems to be a bug fix slated for Chrome6.

mjhm
A: 

Try something like this (JS):

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

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

The suggestion by sibvic works really well in Chrome and FF. It's a good way to have a movie start playing at a defined time point. Perfect for "search inside the video" applications.

BUT it doesn't work in Safari on the iPad. The iPad QT player will not accept a new currentTime setting until it has started playing the movie from T=0. So the user has to click the play icon in the player, then click a button or link to make the time jump. This is clumsy. Does anyone know a solution to automatic time point playing for the iPad?

Quincunx
A: 

Got exact the same problem as Quincunx. Funny thing: if you do a alert before setting the currentTime ... seekin will work without the need of clicking the play button on the ipad. Looks like the currentTime needs a delay...

however its ...very clumsy indeed

Clenn