[mediacapture-main] Only fire devicechange event when devices physically added/removed (#688)

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

== Only fire devicechange event when devices physically added/removed ==
The primary use case for `devicechange` may potentially be undermined by https://github.com/w3c/mediacapture-main/pull/636.

**Primary use case:** Inserting a USB device or enabling a bluetooth headset (e.g. putting on AirPods) during a call, is a **strong signal** users want to switch to it, that many apps want, like a key press.

Unfortunately, with https://github.com/w3c/mediacapture-main/pull/636 Safari is firing `devicechange` immediately upon `getUserMedia` success, for all users with more than one camera and microphone, because the list technically changed.

Problem: as a web developer, I can no longer differentiate between:
 1. The user just inserted or enabled a headset, which I want to switch to immediately.
 2. The user did not insert or enable anything, and I _shouldn't_ switch to a secondary device.


Today, [devicechange](https://w3c.github.io/mediacapture-main/getusermedia.html#event-mediadevices-devicechange) says: *"The set of media devices, available to the User Agent, has changed."*

Note is says: _"available to the **User Agent**"_, not _"the application"_.

The latter would support firing the event whenever the JS-exposed list changes. The former not.

The spec requires there be a change in device availability _to the user agent itself_.

I read that to mean the `devicechange` event MUST NOT fire solely from user agent decisions.

Do we need to clarify the language around this to ensure web compat?

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

Received on Friday, 24 April 2020 19:38:37 UTC