[whatwg] media elements: Relative seeking

Maik Merten maikmerten at googlemail.com
Tue Nov 25 05:35:26 PST 2008

Silvia Pfeiffer schrieb:
> Are you using the byte position to estimate duration or are you using
> the granulepos in Ogg to do this? The granulepos on the last data page
> may be more accurate than simply using byte positions in Ogg. However,
> it may also be more complicated and error-prone.

This applet does not seek to the end of the stream to retrieve a 
timestamp there. Instead, it's simply computing the duration as

duration = currentTime * (totalByteCount / currrentBytePosition)

currentTime is taken from the stream timestamps, totalByteCount from the 
HTTP contentlength and currentBytePosition is the current offset into 
the media resource as used to retrieve the next chunk from the HTTP server.

The latter is only an approximation of the current playback 
byte-position due to buffering and I still need to substract the bytes 
in the buffer, so the current state is vastly suboptimal.

> In any case - if you (and also Chris Double) are satisfied with the
> estimates you're getting for file duration/length - I'll stop arguing
> for it. It would be nice to hear some experimental evidence about how
> well it's doing, e.g. for typical movie trailers, so we can lay that
> argument to bed knowing we've done our homework.

I'll continue to experiment.


More information about the whatwg mailing list