Re: [mediacapture-screen-share] Revisit: Let getDisplayMedia() influence the default type choice in the picker (#184)

>  * The spec is talking about displaySurface as a setting and as a capability, not as a constraint,

It is explicitly [listed as a constrainable property](https://w3c.github.io/mediacapture-screen-share/#constrainable-properties) and a [constraint](https://w3c.github.io/mediacapture-screen-share/#dom-mediatrackconstraintset-displaysurface).

> Are browsers rejecting {displaySurface: { exact :...}}

They would if any of them were implemented [to spec](https://w3c.github.io/mediacapture-screen-share/#dom-mediadevices-getdisplaymedia): _"If CS contains a member whose name specifies a constrainable property applicable to display surfaces, and whose value in turn is a dictionary containing a member named either `min` or `exact`, return a promise rejected with a newly created `TypeError`."_

Which means [this](https://jsfiddle.net/jib1/mepa7zhf/) MUST throw `TypeError`:
```js
await navigator.mediaDevices.getDisplayMedia({video: {displaySurface: {exact: "window"}}});
```

The spec [also says](https://w3c.github.io/mediacapture-screen-share/#dfn-local-audio-playback-suppression): _"While min and exact constraints produce TypeError on getDisplayMedia(), this specification does not alter the track.applyConstraints() method. Therefore, they may instead produce OverconstrainedError or succeed depending on values, ..."_

Which means [this](https://jsfiddle.net/jib1/vqxpwg7c/) MUST throw `OverconstrainedError` in practice (no browser offers `"application"` today):
```js
const stream = await navigator.mediaDevices.getDisplayMedia();
const [track] = stream.getVideoTracks();
await track.applyConstraints({displaySurface: {exact: "application"}});
```
> * displaySurface is not currently supported in implementations as a constraining value. The way we will treat it will be specific: we might need to add code to check for 'exact'.

Browsers are already required to do so by the spec.

>     * We might want to not support screen. Again specific code for just that property.

We can trivially add `"monitor"` to the list of `TypeError`s.

>     * Putting more of the type checks using WebIDL is a good pattern.
> 
>     * Why should we allow two way of writing the same things (with or without ideal?)

You could say this about any constraint in mediacapture-main, so this seems like a larger issue, and out of scope for this issue.

if `displaySurface` weren't already a constraint, a novel API might have some merit, but the spec already mandates browsers implement it as a constraint, so why would we allow two ways of writing the same thing?

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 22 September 2021 15:06:32 UTC