Re: [mediacapture-screen-share] Conditional Focus (When Display-Capture Starts) (#190)

@alvestrand asked me to outline the API shape I propose. I'd prefer:
```js
console.log(navigator.mediaDevices.displayMediaFocusMode); // "focus"

const stream = await navigator.mediaDevices.getDisplayMedia();
navigator.mediaDevices.displayMediaFocusMode = "no-focus"; // stream's target won't be focused
```
It's a simple read-write enum attribute with two values. It never changes value except when JS changes it.

UA reads it in a task queued from `getDisplayMedia`'s success task, to determine whether to focus what was just resolved.

The app can set it ahead of time as well, if it doesn't care what the user picks:
```js
navigator.mediaDevices.displayMediaFocusMode = "no-focus"; // stream's target won't be focused
const stream = await navigator.mediaDevices.getDisplayMedia();
```

**TL;DR:** it affects subsequent calls, _but_ if you set it immediately, it affects what just resolved as well.

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


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

Received on Thursday, 23 September 2021 00:28:35 UTC