- From: Elad Alon via GitHub <sysbot+gh@w3.org>
- Date: Mon, 27 Sep 2021 17:09:56 +0000
- To: public-webrtc-logs@w3.org
> > I do not think the plan for setting this attribute is to raise an exception.
>
> Agreed (not beyond WebIDL's `TypeError` for invalid enum values).
Contrast:
#### 1.
```js
const stream = await navigator.mediaDevices.getDisplayMedia();
const [track] = stream.getVideoTracks();
await someOtherPromisesThatResolvesMuchLater;
track.focus("no-focus-change");
```
#### 2.
```js
const stream = await navigator.mediaDevices.getDisplayMedia();
const [track] = stream.getVideoTracks();
await someOtherPromisesThatResolvesMuchLater;
navigator.mediaDevices.focusPolicy = "no-focus-change";
```
#### 3.
```js
const stream = await navigator.mediaDevices.getDisplayMedia();
const [track] = stream.getVideoTracks();
await immediatelyResolvedPromise;
navigator.mediaDevices.focusPolicy = "no-focus-change";
const otherStream = await navigator.mediaDevices.getDisplayMedia();
```
* The first can throw an exception that explains to Web-developers why what they're doing is not having the desired effect.
* The second has to accommodate the option that the Web-developer actually intended to set the *new* policy, going forward, completely independently of the call to gDM that has already resolved.
* The third affects the gDM call that just resolved. Maybe it's what the developer wanted; or maybe they actually intended to only affect `otherStream`, and this is actually the inverse bug of the second example. Who knows?!
Only the first option produces consistent results (and raises a clear exception when used incorrectly).
--
GitHub Notification of comment by eladalon1983
Please view or discuss this issue at https://github.com/w3c/mediacapture-screen-share/issues/190#issuecomment-928081236 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Monday, 27 September 2021 17:09:58 UTC