[mediacapture-main] Inconsistencies around double filtering of "devicechange" events (#810)

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

== Inconsistencies around double filtering of "devicechange" events ==
Similar but different filtering for "devicechange" events happens *before* and *within* [device change notification steps](https://w3c.github.io/mediacapture-main/#dfn-device-change-notification-steps).

Filtering *before* the notification steps is provided by two pieces of prose that determine when to run the steps:
> [When new media input and/or output devices of a MediaDeviceKind are made available where zero devices of that MediaDeviceKind were available before, or the lone input and/or output device of a MediaDeviceKind becomes unavailable, the User Agent MUST run the following device change notification steps in browsing contexts for which device enumeration can proceed is true and device information can be exposed is false, but in no other contexts:](https://w3c.github.io/mediacapture-main/#dfn-device-change-notification-steps)

> [Additionally, when new media input and/or output devices are made available, or any available input and/or output device becomes unavailable, or the system default for camera or microphone changed, the User Agent MUST run the device change notification steps in browsing contexts for which device enumeration can proceed is true and device information can be exposed is true, but in no other contexts.](https://w3c.github.io/mediacapture-main/#ref-for-dfn-device-change-notification-steps-1)

However, changes affecting the [`enumerateDevices()`](https://w3c.github.io/mediacapture-main/#dom-mediadevices-enumeratedevices) algorithm have sometimes not been reflected in this prose, which leads to missing "devicechange" events when `enumerateDevices()` results should change.  Results do not change when [[storedDeviceList]] is non-`null`. e.g.
1. Removal or re-addition of audio output devices [exposed by](https://github.com/w3c/mediacapture-output/pull/109) `selectAudioOutput()` generate no "devicechange" events and do not reset [[storedDeviceList]] when there is another audio output device and [device information can be exposed](https://w3c.github.io/mediacapture-main/#device-information-can-be-exposed) is false.  [Device information can be exposed](https://w3c.github.io/mediacapture-main/#device-information-can-be-exposed) represents microphones and cameras and so should not be required for exposure of speaker devicechange events.
2. Changes to the system default audio output [do not](https://github.com/w3c/mediacapture-main/issues/809) generate "devicechange" events and nor reset [[storedDeviceList]].

Filtering *within* the notification steps is provided by the first step:
> [If [[storedDeviceList]] already lists the exact same set of devices in the same order as the list of devices that would be generated by a call to enumerateDevices now, then abort these steps.](https://w3c.github.io/mediacapture-main/#dfn-device-change-notification-steps)

However, [[storedDeviceList]] is often `null`, in which case "devicechange" events are often generated for `MediaDeviceKind`s that the document is not [allowed to use](https://html.spec.whatwg.org/multipage/iframe-embed-object.html#allowed-to-use) and for audio output devices that are [not exposed](https://w3c.github.io/mediacapture-output/#privacy-obtaining-consent).

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


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

Received on Wednesday, 4 August 2021 07:31:05 UTC