- From: Eric Carlson <eric.carlson@apple.com>
- Date: Sun, 13 Dec 2009 21:12:32 -0800
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)"> </video> 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)"> </video> 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. eric [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