[whatwg] So if media-queries aren't for determining the media to be used what are they for?

Silvia Pfeiffer silviapfeiffer1 at gmail.com
Tue May 15 18:50:21 PDT 2012

On Wed, May 16, 2012 at 9:20 AM, Odin Hørthe Omdal <odinho at opera.com> wrote:
> Silvia Pfeiffer <silviapfeiffer1 at gmail.com> skreiv Wed, 16 May 2012 00:57:48
> +0200
>>> Media queries come from the client side. They allow the author of a web
>>> page to tell exactly how she want to lay out her design based on the
>>> different queries. The browser *HAS* to follow these queries. And also,
>>> I don't think (please correct me if wrong) the media query can be subset
>>> to only the stuff that's really meaningful to do at prefetch-time.
>>> The srcset proposal, on the other hand, are purely HINTS to the browser
>>> engine about the resources. They are only declarative hints that can be
>>> leveraged in a secret sauce way (like Bruce said in another mail) to
>>> always optimize image fetching and other features. If you make a new
>>> kind of browser (like e.g. Opera mini) it can have its own heuristics
>>> that make sense *for that single browser* without asking _anyone_.
>>> Without relying on web authors doing the correct thing, or changing
>>> anything or even announce to anyone what they are doing. It's opening up
>>> for innovation, good algorithms and smart uses in the future.
>>> That's the basic difference, totally different.
>> If that's the case, would it make sense to get rid of the @media
>> attribute on <source> elements in <video> and replace it with @srcset?
> Video is at least a bit different in that you don't expect it to be fully
> loaded and prefetch at such an early stage as img. But I've been thinking
> about that since I read something like "we already have media queries in
> source for video, but it's not really implemented and used yet".

Some browsers support @media in video for min/max width and height
specifications. But I believe the use case is more like the one we are
trying to solve with @srcset than a traditional media queries use

> I'm not sure. What do you think? As far as I've seen, you're highly
> knowledgeable about <video>. Why do we have mediaqueries on video element?
> Do we have a use case page?

Hehe, thanks. :-) But media queries were in <video> before I arrived,
so I missed the whole discussion around it and how it got there. Some
of the browsers that implement support for it should speak up.

> Doing the same as whatever <img> ends up doing
> might be a good fit if the use cases are similar enough. Would be nice to be
> consistent if that makes sense.

I'm not 100% sure I grok the difference between media queries and
@srcset. I threw this question into the mix to see the reaction -
maybe we need both? What would that even mean?

In addition, I wonder about the adaptive streaming case where byte
ranges from different files are being switched to dynamically during
playback because of bandwidth change. For video, the solution seems to
be: use a manifest file in your @src (such as DASH) and rely on the
browser to pick between the files. Or you use javascript:
. An attribute like @srcset would allow listing the alternative files
directly in the HTML file. That may be preferable?

More questions than answers right now, but we should think
consistently between audio, video and images.


More information about the whatwg mailing list