[whatwg] <source> media attribute behavior, static or dynamic ?
Paul Adenot
padenot+whatwg at mozilla.com
Thu May 10 14:03:15 PDT 2012
Currently implementing the media attribute of the source element in
Gecko, we are unsure about what the specification requires us to do there.
Considering this example :
<video>
<source src="lowres.webm" media="max-width:500px">
<source src="highres.webm">
</video>
what is the expected behavior of a page containing such code being
loaded, in a page that is 1000px width, and then being resized to be
under 500px?
Should the media currently playing change? Is the media attributes and
the multiple <source> attribute only taken into account when the page is
loaded?
The spec [1] says :
> Dynamically modifying a source element and its attribute when the
> element is already inserted in a video or audio element will have no
> effect. 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. Generally,
> manipulating source elements manually after the document has been
> parsed is an unncessarily complicated approach.
which seems to indicate that the <source> element are only used at load
time. Since |canPlayType()| is mentioned, |matchMedia()| is possibly the
right approach here, but it is unclear to us what the spec exactly
requires. We think the spec needs clarification here.
Thanks,
Paul.
More information about the whatwg
mailing list