Re: [mediacapture-screen-share-extensions] Auto-pause for Captured Surface Switching (2nd edition) (#15)

> * firing two distinct events is awkward

Say X is used for local playback and Y is used for sending to the network, we will want X to continue displaying (ignore the event) and Y to stop sending (register the event and call replaceTrack to `null` or a synthetic freeze track). It seems good to have 2 different events here. Also, this would allow the worker to receive video frames without waiting for the window event to be fired.

Say now we only have X which is transfered to a worker.
The event will fire where it is the least useful.
There is no way for the app to react synchronously. Hence the need in the proposal to set track.enabled to false, which is supposed to be in full control of the web application, not the UA. And the need to somehow handle transferable clones.

Wrt dealing with several events, this is not too difficult to manage:
1. Do surface switch checks/event listening in a single track (say the first one used for local preview)
2. Coalesce all events of same context track clones in a single callback, for instance:
```
track.onconfigurationchange = e => {
  if (captureController.currentDeviceId == track.getSettings().deviceId)
    return;
  captureController.currentDeviceId = track.getSettings().deviceId;
  // Handle surface switching
  notifyUserOfSurfaceSwitching();
}
```

-- 
GitHub Notification of comment by youennf
Please view or discuss this issue at https://github.com/w3c/mediacapture-screen-share-extensions/issues/15#issuecomment-2432450287 using your GitHub account


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

Received on Wednesday, 23 October 2024 14:39:22 UTC