W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2012

Re: [whatwg] <source> media attribute behavior, static or dynamic ?

From: Ian Hickson <ian@hixie.ch>
Date: Thu, 10 May 2012 23:08:17 +0000 (UTC)
To: Paul Adenot <padenot+whatwg@mozilla.com>
Message-ID: <Pine.LNX.4.64.1205102302110.25792@ps20323.dreamhostps.com>
Cc: whatwg@lists.whatwg.org
On Thu, 10 May 2012, Paul Adenot wrote:
> >
> > As far as I can tell, the behaviour here is strictly and unambiguously 
> > defined, leaving only one possible interpretation, so it's not clear 
> > to me how to make it less ambiguous. Could you elaborate on what 
> > interpretations of the spec you think are possible?
> 
> We have two possible interpretations, here :
> 1. If the environment of the user changes, then the source of the video has to
> change according to the different child source element and their respective
> media queries.
>
> [...]
> 
> Support for the first interpretation :
> 
> > Dynamically modifying a source element and its attribute when the
> > element is already inserted in a video or audio element will have no
> > effect.
> 
> We are never modifying the source elements, we are only relying on the media
> attribute of those elements. We therefore can't conclude that by having a
> read-only behavior, the media that is currently playing will not change.

The spec says _exactly_ what it means. You do not need to ever read 
between the lines. Here, the paragraph only says that modifying the 
attribute has no effect. It doesn't say anything else. It doesn't say that 
if the environment changes, anything happens. It doesn't say that if the 
phase of the moon is "full", that the video should play backwards. 
Presumably you haven't interpreted it to suggest that you should play 
backwards in a full moon. :-) The same applies to anything else.

Furthermore, the paragraph you quote above is non-normative. The paragraph 
doesn't say anything with a "must", it doesn't define any terms. It 
therefore can not in any way affect what an implementation does.


> Support for the second interpretation :
> 
> > To change what is playing, just use the src attribute on the media 
> > element directly, possibly making use of the canPlayType() method to 
> > pick from amongst available resources.

This paragraph is not normative either. Again, it has no conformance 
criteria ("must") and doesn't define anything.

Please, as an implementor, ignore everything that isn't a conformance 
criteria.


> The "just" word here seems to imply modifying the src attribute of the 
> audio or video parent is the only way to change the media that is 
> playing. By deduction, media attributes of children source elements 
> cannot change a the source that is currently playing.

If at any time you are finding yourself worrying about what hte spec 
implies, or deducing anything about what the spec means, stop, you don't 
ever have to do that. :-)


The only place in the spec that is in any way affected by the "media" 
attribute on the <source> element (other than the .media IDL attribute) is 
step 6, substep 6, of the "resource selection algorithm". The only time, 
therefore, that you should ever be affected by the media="" attribute, is 
when you reach that step in your implementation. There is nothing that 
causes that to happen when the environment changes.

HTH,
-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Thursday, 10 May 2012 23:08:47 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:08 GMT