[whatwg] <video> resource selection algorithm and NETWORK_NO_SOURCE

On Mon, 26 Jul 2010 02:58:07 +0200, Silvia Pfeiffer  
<silviapfeiffer1 at gmail.com> wrote:

> On Sun, Jul 25, 2010 at 3:31 PM, Maciej Stachowiak <mjs at apple.com> wrote:
>
>>
>> On Jul 23, 2010, at 7:16 AM, Philip J?genstedt wrote:
>>
>> Silvia made we aware of discrepancy in how browsers implement the  
>> resource
>> selection algorithm, see forwarded message. It's my assessment that  
>> Opera is
>> the only browser following the spec. I've filed this bug with Mozilla:
>>
>> https://bugzilla.mozilla.org/show_bug.cgi?id=581355
>>
>> I've also reported bugs in Chrome and Safari, but can't see where they
>> ended up.
>>
>> The reason I'm writing this email is that apparently everyone but myself
>> has a different interpretation of the spec, so perhaps this is  
>> something we
>> need to discuss. Does any other browser ever set the state  
>> NETWORK_NO_SOURCE
>> at all? I speculated that perhaps other browsers aren't very strict  
>> about
>> which parts of the algorithm are run synchronously and not, but even
>> checking the networkState after a setTimeout it still isn't
>> NETWORK_NO_SOURCE.
>>
>> Test case: http://people.opera.com/philipj/2010/07/23/networkState.html
>>
>> Please fix implementation or spec :)
>>
>>
>> 1) Which behavior is more useful?
>> 2) Sylvia's original issue was with play() - should we ensure that any  
>> time
>> you call play(), it will cause the media resource to start playing once
>> loaded? That seems like the real spec bug.
>>
>
> The problem there with play in Opera was that the @src was changed, but
> Opera doesn't run the resource selection algorithm to load it for play(),
> but instead expects to run load() first. The description of play()  
> however
> clearly states as a first step:
> 1. If the media
> element<http://www.whatwg.org/specs/web-apps/current-work/complete/video.html#media-element>'s
> networkState<http://www.whatwg.org/specs/web-apps/current-work/complete/video.html#dom-media-networkstate>attribute
> has the value
> NETWORK_EMPTY<http://www.whatwg.org/specs/web-apps/current-work/complete/video.html#dom-media-network_empty>,
> invoke the media
> element<http://www.whatwg.org/specs/web-apps/current-work/complete/video.html#media-element>'s
> resource selection
> algorithm<http://www.whatwg.org/specs/web-apps/current-work/complete/video.html#concept-media-load-algorithm>
> .
>
> This is why we are discussing whether the networkState needs to be
> NETWORK_EMPTY or NETWORK_NO_SOURCE after initialisation of a media  
> element.
>
> Incidentally, that has effects on other elements, too, such as for  
> <source>
> it is stated:
> If a  
> source<http://www.whatwg.org/specs/web-apps/current-work/complete/video.html#the-source-element>element
> is inserted as a child of a media
> element<http://www.whatwg.org/specs/web-apps/current-work/complete/video.html#media-element>that
> has no
> src<http://www.whatwg.org/specs/web-apps/current-work/complete/video.html#attr-media-src>attribute
> and whose
> networkState<http://www.whatwg.org/specs/web-apps/current-work/complete/video.html#dom-media-networkstate>has
> the value
> NETWORK_EMPTY<http://www.whatwg.org/specs/web-apps/current-work/complete/video.html#dom-media-network_empty>,
> the user agent must invoke the media
> element<http://www.whatwg.org/specs/web-apps/current-work/complete/video.html#media-element>'s
> resource selection
> algorithm<http://www.whatwg.org/specs/web-apps/current-work/complete/video.html#concept-media-load-algorithm>
> .
>
> And for @src it is said:
> If a  
> src<http://www.whatwg.org/specs/web-apps/current-work/complete/video.html#attr-media-src>attribute
> of a media
> element<http://www.whatwg.org/specs/web-apps/current-work/complete/video.html#media-element>is
> set or changed, the user agent must invoke the media
> element<http://www.whatwg.org/specs/web-apps/current-work/complete/video.html#media-element>'s
> media element load
> algorithm<http://www.whatwg.org/specs/web-apps/current-work/complete/video.html#media-element-load-algorithm>.
> (*Removing* the
> src<http://www.whatwg.org/specs/web-apps/current-work/complete/video.html#attr-media-src>attribute
> does not do this, even if there are
> source<http://www.whatwg.org/specs/web-apps/current-work/complete/video.html#the-source-element>elements
> present.)
>
> That is kinda strange, too, because really when @src is changed, resource
> selection has to be run first rather than media element load.

The load algorithm is just a wrapper for the resource selection algorithm  
that makes sure that a previously running resource selection algorithm is  
aborted in an orderly fashion and that the state is reset. What's strange?

> The easiest way to get this consistent is to keep the meaning of
> NETWORK_EMPTY and NETWORK_NO_SOURCE and make sure everything else is made
> consistent with that, i.e.
> * change the first state of the resource selection to use NETWORK_EMPTY
> * change the first action of @src to run the resource selection algorithm
> rather than the resource load algorithm
>
> Any other changes would cause a lot more follow-on changes IMO.

I disagree that any change is needed, especially the first would be  
harmful as explained in my other reply.

-- 
Philip J?genstedt
Core Developer
Opera Software

Received on Monday, 26 July 2010 02:49:02 UTC