W3C home > Mailing lists > Public > www-style@w3.org > March 2013

Re: [mediaqueries4] Media queries for physical resolution

From: Mark Watson <watsonm@netflix.com>
Date: Sat, 23 Mar 2013 17:23:29 +0000
To: Florian Rivoal <florian@rivoal.net>
CC: Sylvain Galineau <galineau@adobe.com>, Tab Atkins Jr. <jackalmage@gmail.com>, Kenneth Rohde Christiansen <kenneth.r.christiansen@intel.com>, "www-style@w3.org" <www-style@w3.org>
Message-ID: <6C190DB4-EBD7-4DCE-857E-4937ED877C65@netflix.com>
(Splitting the thread)

Sent from my iPhone

On Mar 23, 2013, at 6:52 AM, "Florian Rivoal" <florian@rivoal.net> wrote:

> On Thu, 21 Mar 2013 00:07:15 +0100, Mark Watson <watsonm@netflix.com> wrote:
> 
> 
>> Tab suggests we need some way to declare the resolution, or channel count, of the media to the UA, but that would move the responsibility for deciding how to match media properties with physical properties from the user to the UA
> 
> I guess you meant "from the author to the UA". Which I would say is a good thing. The author knows best about which types of media are available, but the UA (on behalf of the user) knows best about the rendering environment.
> 
> You said video only ever care about physical pixels, as you want to show it bigger on bigger screens, but I think it is not that simple. Video is not always full screen, so knowing the screen's number of pixel doesn't help you, you want the rendering area's number of pixels.

That would also be useful - however I may or may not want to switch dynamically based in changes in the rendering area size, so it should be possible to make an initial selection based on the maximum size in device pixels i.e. screen resolution.

> And even then, it isn't that simple, as the video element may be scaled up or down using CSS transforms, or even rotated, possibly in 3D. Or maybe the user agent has a zooming in and out mechanism either for page navigation, or for tab switching.

True - those things make dynamic determination of the actual rendering area device pixel count very difficult. Perhaps knowing the maximum is the best we can do for now.

> 
> No matter what is happening to the video rendering surface, the UA has to know about it. If we want a javascript based selecting system to be able to make an equally inteligent choice, all that information (and more: the timing of the animation if any is applied to the transform, network conditions...). Exposing all that through media queries in not possible. 

IIUC, it is presently possible to define quite complex sets of conditions with media queries and get notifications when the match state of a given query changes (through the mediaMatch function). A script could use those notifications to determine whether it was or was not appropriate to change resource selection. Note that you usually have some media buffered, so resource selection changes don't take place immediately.

> You could try crafting some javascript API independently, but I don't think this is an effective approach.
> 
> Whether you do it in markup or via scripts, describing the media to the UA and letting it pick the ideal variant seems a lot easier, so that's the direction I would look into.

So I'm confused why you advocate this approach for this particular aspect (resolution) when the video element resource selection algorithm and the existing system of media queries takes the opposite approach for many other device properties (size, aspect ratio, orientation, color depth, etc.)

I can see how a declarative approach for the HTML Media Element could work, by adding attributes such as resolution and frame rate to the <source> element, but for a script-based approach with Media Source we would need a completely new API with which to declare the available streams and new events for the UA to request selection and re-selection of the streams. We run into problems where the script is _also_ trying to switch streams for reasons the UA does not understand (throughput, user preferences and selections). It seems a lot more work and a lot less promising.

By contrast, simply defining a length unit of 'device pixels', say dpx, for use in media queries, seems relatively simple and addresses this use-case in a way that is consistent with existing resource selection, both declarative and script-based, for other properties. For example

<source media='min-display-height: 1080dpx' ... />

...Mark 
> 
> - Florian
> 
Received on Saturday, 23 March 2013 17:23:57 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:07 GMT