w3c / mediacapture-output

API to manage the rendering of audio on any audio output device
https://w3c.github.io/mediacapture-output/
Other
26 stars 25 forks source link

setSinkId("") vs setSinkId(defaultDeviceId) #94

Closed jan-ivar closed 4 years ago

jan-ivar commented 4 years ago

This spec defines "" to mean the "user-agent default device", e.g. status quo without this spec.

At least on macOS this OS default is dynamic and may change live. As such, these differ:

await element.setSinkId(""); // Follow the dynamic OS default 
await element.setSinkId(defaultDeviceId); // Stop following the dynamic OS default 

With the second one, the element stops responding to user changes in the OS.

The problem is the spec right now implies both of these may be called without consent, which seems wrong: "If the application is not permitted to play audio through the device identified by sinkId, reject p ", and: "The specification adds no permission requirement to the default audio output device.".

We propose changing the spec here to require consent for anything other than "", since it allows JS to stop following the (potentially changing) OS default, and instead track the physical device that was default at the time of the call.