[mediacapture-main] Should devicechange fire when the device info changes? (#966)

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

== Should devicechange fire when the device info changes? ==
I noticed a browser inconsistency in the way the `'devicechange'` event gets fired. But I think the spec isn't very clear which browser is behaving correctly.

These days all browsers reduct the information available by querying `enumerateDevices()` as long as the page has for example no permission to access the microphone. However this changes after a successful call to `getUserMedia()`. This behavior seems to be similar across all browser.

But only Safari fires a `'devicechange'` event when it exposes the `label` of a device as a result of a permission change. This inconsistency can be easily worked around by calling `enumerateDevices()` again after each call to `getUserMedia()` but it doesn't work if the user changes the page permission in the browser settings.

The spec currently says ...

> When new media input and/or output devices are made available to the [User Agent](https://w3c.github.io/mediacapture-main/#dfn-user-agent), or any available input and/or output device becomes unavailable, or the system default for input and/or output devices of a [MediaDeviceKind](https://w3c.github.io/mediacapture-main/#dom-mediadevicekind) changed, ...

At least on my MacBook Chrome is the only browser which actually adds a device after the user has granted permissions to see the full list of devices. It shows the default device twice. However it doesn't fire a `'devicechange'` event.

Firefox only changes the `label` which I would argue means the device is still the same and therefore `'devicechange'` shouldn't fire at least in the way it is defined today.

Safari changes all properties including `deviceId` and `groupId` which could be interpreted as a completely new device. It consequently fires a `'devicechange'` event.

As a developer building applications using this API I would love all browsers to fire a `'devicechange'` event whenever anything changes in the device list including `label` changes.

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


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

Received on Friday, 21 July 2023 09:56:17 UTC