- From: Jan-Ivar Bruaroey via GitHub <sysbot+gh@w3.org>
- Date: Thu, 17 Dec 2020 22:31:07 +0000
- To: public-webrtc@w3.org
jan-ivar has just created a new issue for https://github.com/w3c/mediacapture-main: == Is getSettings returning rotated dimensions a footgun? == The spec with https://github.com/w3c/mediacapture-main/pull/760 documents [existing browser behavior](https://jsfiddle.net/jib1/e5dkao41/show) of always applying constraints in landscape mode, only flipping `width`, `height` and `aspectRatio` for portrait mode in `getSettings`. Are there use cases for relying on current settings as a basis for applying new constraints? If so, is this a footgun? I can think of one: locking a camera down to a mode already negotiated, to prevent the camera from changing over time, ```js const {width, height, aspectRatio: ar} = track.getSettings(); await track.applyConstraints({width: {exact: width}, height: {exact: height}, aspectRatio: {exact: ar}}); // Success in landscape mode, but OverconstrainedError in portrait mode! ``` ...but this should be unnecessary in modern browsers, which will downscale before revealing another page's camera settings anyway, even with `resizeMode: "none"`, so do we care? #### Workaround ```js const {width, height, aspectRatio: ar} = track.getSettings(); if (width < height) { [width, height] = [height, width]; aspect = 1 / aspect; } await track.applyConstraints({width: {exact: width}, height: {exact: height}, aspectRatio: {exact: ar}}); // Success in both portrait and landscape mode ``` The workaround assumes the [primary orientation](https://w3c.github.io/mediacapture-main/getusermedia.html#dfn-primary-orientation) is landscape, which holds true in implementations today. If this workaround is sufficient, should we add a note or an example about it? If not, should we consider a `settings.rotated` boolean, or some other non-breaking fix? Please view or discuss this issue at https://github.com/w3c/mediacapture-main/issues/761 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 17 December 2020 22:31:09 UTC