[mediacapture-screen-share] A CaptureController object for getDisplayMedia() (#230)

jan-ivar has just created a new issue for https://github.com/w3c/mediacapture-screen-share:

== A CaptureController object for getDisplayMedia()  ==
As promised in https://www.w3.org/2022/05/17-webrtc-minutes.html#t05 a dedicated controller object for getDisplayMedia.

An initial version would be aimed at solving #190 for now:
```js
const controller = new CaptureController();
const stream = await navigator.mediaDevices.getDisplayMedia({controller});

if (focus) {
  await controller.focus(); // Defaults is no focus when controller is associated.
}
```

The controller is associated 1 ←→ 1 upon getDisplayMedia success, and cannot be re-associated after that.

1. Presence of the controller suppresses the automatic bring-to-front with focus that happens today.
2. Without a controller, getDisplayMedia would bring-to-front with focus like today for backwards compatibility.
3. Apps may call focus() anytime ahead of getDisplayMedia or right after it (upto 1 second after seems fine, but let’s iterate on details). Rejects with InvalidStateError after a timeout or if capture has stopped, whichever is sooner.
4. focus() resolves after the captured window or tab has been brought to front and focused, or asap for monitor display surfaces, but no earlier than gDM success.

Please view or discuss this issue at https://github.com/w3c/mediacapture-screen-share/issues/230 using your GitHub account


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

Received on Wednesday, 31 August 2022 22:18:53 UTC