W3C home > Mailing lists > Public > public-html@w3.org > July 2009


From: Ian Hickson <ian@hixie.ch>
Date: Thu, 2 Jul 2009 05:14:28 +0000 (UTC)
To: Simon Pieters <simonp@opera.com>
Cc: "public-html@w3.org" <public-html@w3.org>
Message-ID: <Pine.LNX.4.62.0907020453390.1060@hixie.dreamhostps.com>
On Mon, 8 Jun 2009, Simon Pieters wrote:
> The load() algorithm says
>    If the media element's networkState is not set to NETWORK_EMPTY, then
>    run these substeps:
> If you create a media element with script, then networkState will be
> NETWORK_EMPTY. But if you insert it into the document it will instead be
> NETWORK_NO_SOURCE. Thus, you get an 'emptied' event in the latter case but not
> in the former. This seems like a spec bug.

You get an 'emptied' event if you call load() twice, whether the load() is 
implicit (e.g. inserting the element into the document) or explicit 
(actually calling it directly). This is intentional.

> It seems that the only differences it makes is whether these steps will be run
> when inserting a media element with no source:
>    Run the remainder of the resource selection algorithm steps
>    asynchronously, allowing the task that invoked this algorithm to
>    continue.
>    While the media element has neither a src attribute nor any source
>    element children, wait. (This step might wait forever.)
> and
>    When a media element is removed from a Document, if the media element's
>    networkState attribute has a value other than NETWORK_EMPTY then the
>    user agent must act as if the pause() method had been invoked.
> Both of these seem to not really make a difference.
> Thus we suggest to merge the NETWORK_NO_SOURCE and NETWORK_EMPTY states.

The difference is in what should happen if you call .play().

If you call play() while the algorithm is already loading a media 
resource, or after it has given up trying to load the resource given by 
src="", then it won't do anything. If you call it before calling load() 
(or inserting the element into the DOM), then it implies a call to load().

This becomes especially relevant if you are dripping <source> elements in 
one by one. You don't want a call to play() to cause the UA to restart the 
whole operation and go through past <source> elements again, since that 
would make play() trigger a bunch of unrelated 'error' events.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Thursday, 2 July 2009 05:15:04 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 9 October 2021 18:44:50 UTC