W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2009

[whatwg] Quality Values for Media Source Elements

From: Eric Carlson <eric.carlson@apple.com>
Date: Sun, 13 Dec 2009 21:12:32 -0800
Message-ID: <0D18D762-EDF0-42C7-B2C5-EB154163A738@apple.com>

On Dec 13, 2009, at 8:12 PM, Silvia Pfeiffer wrote:

> Oh! What are you doing with it? I mean - have the values in the media
> attribute any effect on the video element?
  Certainly! WebKit evaluates the query in the 'media' attribute if it believes it can handle the MIME type. If the query evaluates to true, it uses that <source> element. If it evaluates to false it skips it, even though it could (in theory) open the movie. For example, one of our layout tests [1] has the following :

<video controls>
    <source src=content/error.mpeg media="print">
    <source src=content/error2.mpeg media="screen and (min-device-width: 80000px)">
    <source src=content/test.mp4 media="screen and (min-device-width: 100px)">

  The test fails if the video element is instantiated with anything but "test.mp4".

  I have seen 'media' used on real-world pages with something like the following to select different movies for the iphone and desktop:

<video controls>
    <source src='desktop-video.mp4' media="@media screen and (min-device-width: 481px)">
    <source src='iphone-video.mp4' media="@media screen and (min-device-width: 480px)">

  This works because the <source> elements are evaluated in order, so the first one is selected on the desktop where both queries will evaluate to true.


[1] http://trac.webkit.org/browser/trunk/LayoutTests/media/video-source-media.html?format=txt

> Thanks,
> Silvia.
> On Mon, Dec 14, 2009 at 2:43 PM, Eric Carlson <eric.carlson at apple.com> wrote:
>> On Dec 13, 2009, at 2:35 PM, Silvia Pfeiffer wrote:
>>> This is why the @media attribute hasnt' been used/implemented anywhere yet
>>  Are you saying that nobody has implemented the "media" attribute on <source>? If so, you are incorrect as WebKit has had this for almost two years.
>> eric
Received on Sunday, 13 December 2009 21:12:32 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:54 UTC