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

I'm not in favor of changing when `devicechange` fires. Its intent was to denote real device changes, not changes to exposure or permission.

The spec is in much better shape than current implementations, so I caution against making inferences from observations of current browsers:

1. Safari is closest to spec
2. Firefox with `media.devices.enumerate.legacy.enabled` set to `false` in about:config is [shipping soon](https://groups.google.com/a/mozilla.org/g/dev-platform/c/AJp9KF5Ml3w/m/ISyYK9lBAQAJ) to match Safari
3. Chrome and Firefox still work the "legacy" way, which is [crbug 1101860](https://crbug.com/1101860) in Chrome.

> But only Safari fires a 'devicechange' event when it exposes the label of a device as a result of a permission change. 

Exposure tied to permission is legacy. In the spec and Safari it's instead tied to calling getUserMedia, which is much simpler.

From testing with this [demo page](https://jan-ivar.github.io/dummy/enumerate.html), Safari only fires this event if the app calls enumerateDevices first, a bug?

> 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.

It sounds like Safari here is taking advantage of the following note:

<img width="793" alt="image" src="https://github.com/w3c/mediacapture-main/assets/3136226/f77bad9d-cf08-4b8a-a80f-97d1de5797b1">

Apps can use [permissions.query](https://w3c.github.io/permissions/#dom-permissions-query) for that. 

I don't think the app is owed a `devicechange` event in that special case. If anything, apps are better off holding on to the lists they already have and NOT update in this case which will just erase the info.

Once implementations align, it should simplify things a lot for developers, and there should be no need to want getUserMedia to fire the `devicechange` event.

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


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

Received on Tuesday, 19 September 2023 22:18:09 UTC