Re: [mediacapture-main] How to implement web-compatible camera downscaling?

Observation: The 2nd group has no need for `min`, `max`, `exact`, `ideal`, or `advanced`:
```js
await navigator.mediaDevices.getUserMedia({video: {height: 360}});
```
...is all they need. An inherently simple rescale-me-this API.

### Proposal
Give them that API, and force the 1st group to use `min`, `max`, `exact`, `ideal`, or `advanced`.

That is, have the presence of those keywords be a hint to ignore downscaled [settings dictionaries](https://w3c.github.io/mediacapture-main/getusermedia.html#dfn-settings-dictionary).

This would mean:
 * Only the group that needs them need learn the algorithm-related keywords.
 * `360` would downscale as needed (even in Firefox/Edge).
 * `{ideal: 360}` would find the closest native resolution (even in Chrome).
 * `{exact: 360}` would produce 360p native or `OverconstrainedError` (even in Chrome).
 * No downscaling in `advanced` (even in Chrome).
 * Should work for `frameRate` as well.

Note that this wouldn't otherwise change the meaning of plain values.

#### Examples
```js
await track.applyConstraints({height: 360}); // 360p downscaled if necessary
await track.applyConstraints({height: {ideal: 360}}); // closest native to 360p
await track.applyConstraints({height: {exact: 360}}); // native 360p or throw
await track.applyConstraints({height: {min: 320, max: 1920}}); // native in range or throw
await track.applyConstraints({height: {min: 320, max: 1920, ideal: 320}}); // lowest native
await track.applyConstraints({height: {max: 1920, ideal: 1920}}); // highest native
await track.applyConstraints({height: 9999}); // highest native available
```

Only the first is a change in Firefox/Edge. All but the first, middle and last a change in Chrome.

Win-win? The spec doesn't touch rescale behavior much, but we'd need a vendor agreement at least. It'd be confusing unless this worked the same in all browsers.

@guidou, @fluffy, @aboba, @jesup, @youennf WDYT?

-- 
GitHub Notification of comment by jan-ivar
Please view or discuss this issue at https://github.com/w3c/mediacapture-main/issues/472#issuecomment-320374856 using your GitHub account

Received on Friday, 4 August 2017 23:36:52 UTC