Re: [mediacapture-screen-share] Auto-pause capture when user switches captured content (#255)

> Since the user agent is expecting the application to perform an action in this case, the API should be designed to reflect that.

A user agent cannot expect an application to perform an action. Rather, applications tell APIs what to do.

> It is also important for the user agent to know in advance if the application intends to act ... Setting a callback, can provide this information to the user agent.

The user agent cannot know if the callback handles audio. The only way to know is through opt-in.

Having `controller.setSurfaceSwitchingCallback = () => {};` enable <img width="150" alt="image" src="https://github.com/w3c/mediacapture-screen-share/assets/3136226/7cee238a-7623-4d30-b22c-c41c621554b7"> violates [§7.3. Don’t invent your own event listener-like infrastructure](https://w3ctag.github.io/design-principles/#dont-invent-event-like) which says: _"Create separate API controls to start ... the underlying process."_

E.g. what happens if the callback is set after `getDisplayMedia`? Does it race, or does the UX update?

§7.3. compels us to consider a more declarative API if advance UA knowledge is important. E.g.:
```js
await navigator.mediaDevices.getDisplayMedia({audio: true, surfaceAudioSwitching: "include"});
```


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


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

Received on Thursday, 16 November 2023 23:21:36 UTC