Re: [mediaqueries4] Media queries for physical resolution

(Splitting the thread)

Sent from my iPhone

On Mar 23, 2013, at 6:52 AM, "Florian Rivoal" <> wrote:

> On Thu, 21 Mar 2013 00:07:15 +0100, Mark Watson <> 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' ... />

> - Florian

Received on Saturday, 23 March 2013 17:23:57 UTC