[whatwg] media elements: Relative seeking

Maik Merten maikmerten at googlemail.com
Mon Dec 1 05:06:36 PST 2008


Ian Hickson schrieb:
> You can jump to a position that's a fraction of the whole clip by setting 
> 'currentTime' to a fractional multiple of 'duration'.

Right, I was thinking of what happens if no duration could be determined 
with acceptable effort. However, by now I happen to think that 
determining the duration where possible (even if its not completely 
straightforward) is useful enough to require it.


>>  - make currentTime readonly, still have it report playback position in 
>> absolute time. This information should be available in all media formats 
>> due to timestamps in the stream.
>>
>>  - introduce a seek() method, taking a relative value ranging from zero 
>> to one. This allows both accurate seeking if the duration is known and 
>> less precise seeking otherwise if only the length of the file is known 
>> in storage units. This is still way better than not being able to seek 
>> at all.
> 
> Why should currentTime be readonly?

Because seek() would already to trigger seeking (is there a different 
usecase for a writeable currentTime?). Anyway, I don't suggest paying 
attention to my proposals anymore - after some consideration and 
experimentation I don't think they improve anything ;-)

> On Tue, 25 Nov 2008, Maik Merten wrote:
>> This applet does not seek to the end of the stream to retrieve a 
>> timestamp there.
> 
> It should. :-)

And it now does :-)

http://svn.wikimedia.org/viewvc/mediawiki/trunk/cortado/src/com/fluendo/player/DurationScanner.java?view=log

Byte-position based estimates etc. etc. just didn't work out, so I 
finally gave in ( ;-) ) and wrote the ~200 lines of code to actually Do 
Things Approximately Properly(tm).

Seems I saw an implementation problem where none exists.


> 
> On Wed, 26 Nov 2008, Chris Double wrote:
>> I won't be estimating the duration - the user experience of a 
>> fluctuating duration is terrible. For now for Ogg files, I'm seeking to 
>> the end and getting the duration. I may check for X-Content-Duration 
>> which I believe mod_annodex and soon oggz-chop support.
> 
> Cool.

I now finally arrived at the same conclusions.


Maik



More information about the whatwg mailing list