- From: Jan-Ivar Bruaroey via GitHub <sysbot+gh@w3.org>
- Date: Mon, 13 Nov 2023 18:08:41 +0000
- To: public-webrtc-logs@w3.org
My concern is not addressed. A user agent can trivially limit source-switching (and its implementation burden) to the non-injection kind by limiting the feature to apps that have called `setSourceSwitchCallback` ahead of time.
It's harder to do that with `controller.onsourceswitch`, because a user agent cannot know ahead of time if the app will call `event.preventDefault()`.
Conversely, apps have more freedom with `controller.onsourceswitch` in that they can get notified about switching (including injection) ahead of time without pre-committing to a decision.
Case in point:
> > (Note that this is a quote:)
> > ```js
> > controller.onsourceswitch = event => {
> > if (video.srcObject.getTracks().length == event.stream.getTracks().length) return;
> > video.srcObject = event.stream;
> > event.preventDefault();
> > };
> > ```
>
> The following is even simpler:
>
> ```js
> controller.setSurfaceSwitchingCallback((stream) => {
> video.srcObject = stream;
> });
> ```
These two code snippets do different things. The former illustrates what the latter cannot do (a deferred decision).
--
GitHub Notification of comment by jan-ivar
Please view or discuss this issue at https://github.com/w3c/mediacapture-screen-share/issues/255#issuecomment-1808730088 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Monday, 13 November 2023 18:08:42 UTC