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

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

From: Paul Adenot <padenot+whatwg@mozilla.com>
Date: Thu, 10 May 2012 15:48:22 -0700
Message-ID: <4FAC45B6.9000009@mozilla.com>
To: whatwg@lists.whatwg.org
 > 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.
2. Once a source is loaded, the other source element are never used 
again, despite the environment changing. If the author wants the source 
to change, he has to use matchMedia() or canPlayType(), and query the 
DOM for other available source elements.

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.

 > Generally, manipulating source elements manually after the document
 > has been parsed is an unncessarily complicated approach.

Here, using the media attribute, if we implement the first 
interpretation, we are not "manipulating source elements manually", We 
are automatically loading a new resource.

The main concern here is the fact that the author can think that the 
media attribute of the source element works in the same way than @media 
in CSS : it dynamically changes the source automatically according to 
the user environment.

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.

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.

Received on Thursday, 10 May 2012 22:48:52 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:42 UTC