Re: [mediacapture-main] Racy devicechange event design has poor interoperability (#972)

I'm not clear what problem exists with firing "devicechange" events while an `enumerateDevices()` promise is pending.  The "devicechange" event contains no information, so it is just a signal that a subsequent `enumerateDevices()` call may now return a different device list.  The client app can compare with previous device lists to determine whether changes are significant.  If a "devicechange" event occurs while waiting for an `enumerateDevices()` promise, then the client app knows that another `enumerateDevices()` call is necessary to get an up-to-date device list.

Trying to design the API to protect against bugs in client async code is not going to be something that the API can win.  The client's response to the change in devices is likely to be async and I don't think we want to continue to delay "devicechange" events while *any* async operation is pending.

Something that might be helpful to clients would be to specify that `enumerateDevices()` promises be resolved in the same order as for the corresponding calls on the same `MediaDevices`.

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


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

Received on Thursday, 5 October 2023 22:17:46 UTC