[whatwg] Question on HTML5 media element, the seeking algorithm and the seeked event

Ian Hickson ian at hixie.ch
Fri Dec 6 11:31:30 PST 2013

On Fri, 8 Nov 2013, Andres Gomez wrote:
> because of my recent work related to a bug and test in WebKit, I've 
> gotten to deal with the HTML5 media element's "seeking" algorithm and 
> "seeked" event.
> During my analysis I was unable, following the specs preview, to 
> determine whether on specific conditions, after a "seek" request a 
> "seeked" event would be received.
> The cases could be more complicated but, trying to put it simple, in the 
> "seeking" algorithm of the specs: 
> http://dev.w3.org/html5/spec-preview/media-elements.html#seeking

I recommend using the WHATWG version of the spec, since that's the version 
that I edit in response to comments here. While the W3C version does 
subsequently adopt many of those changes as well, the two versions are 
unfortunately not identical.

In the WHATWG version of the HTML standard, the algorithm you cite above 
is found here:


I mention this because this is in fact one of the algorithms that, for 
reasons I am not familiar with, is in fact different in the W3C version.

> We can read on the step 7, that, on certain conditions:
> "... If there are no ranges given in the seekable attribute then set the 
> seeking IDL attribute to false and abort these steps."

(In the WHATWG version today, this is step 8.)

> Hence, we won't walk the following steps, including the last ones, 13 
> and 14, which would fire the "timeupdate" and "seeked" events.
> However, reading the events summary for the "seeked" one: 
> http://dev.w3.org/html5/spec-preview/media-elements.html#event-media-seeked


> We can read that it is "Fired when...":
> "The seeking IDL attribute changed to false."
> ... which is what happens in the mentioned step 7 of the "seeking" 
> algorithm.

Hm, yes, the non-normative text in the event summary table here was a bit 
overly simplistic.

I've tried to make the summary table more precise for this event. Let me 
know if you think it's still not clear enough!

> Because of this, I'm unsure whether a "seeked" (and "timeupdate" ?) 
> event should be fired when the conditions in step 7 happen.

Per the spec, no. The section with the event summary table explicitly says 
"This section is non-normative", and, even ignoring that, none of the 
statements in that section are normative -- none of them use the word 
"must". Contrast this to the algorithm, which is introduced by the 
requirement that says "the user agent must run the following steps".

See also:


Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list