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

Do we prompt if there's only one audio output device to select? #103

Closed jan-ivar closed 3 years ago

jan-ivar commented 4 years ago

Today selectAudioOutput says: "If there is no audio output device, reject p with a new DOMException whose name attribute has the value NotFoundError."

Since sites already have access to the "user-agent default device" a.k.a. "" (modulo block autoplay), should it instead say:

"If there's no non-default audio output device "? or "Unless there are two or more audio output devices"?

(The latter assumes user agents include the default audio output device in its selection list, which I don't see that we specify).

A related question perhaps is if user agents are allowed to resolve selectAudioOutput with "" instead of a minted deviceId for the default audio-device (and thus exposing more information about the device in enumerateDevices?

The answer to both questions may rest on whether there's sufficient value in letting sites glob onto the device that is presently the user-agent default (e.g. if this default may change over time, which appears true in some OS'es).

Options I see (all counts include the default device):

  1. Reject if there's zero output devices
  2. Reject if there's less than two output devices
  3. Let user agents decide.

Only option 1 requires no change.

guidou commented 4 years ago

I think the current wording is OK. If the only supported device is the default device, resolving with "" looks correct to me.

Note also that the default device ("") and the ID for a specific device are different things in practice. In most OSes, if the default device changes (e.g., via settings), audio will be redirected to the new default device if "" is the chosen device. If the specific device ID of the device that is currently default is selected, no audio will be redirected if the default device changes.

I think it would be good to specify that it should be possible to select the default device with selectAudioOutput.

guidou commented 3 years ago

I think the current language in the spec is OK, which rejects if there's zero devices. If there is only one device and the given ID is a valid one different from "", the spec already allows resolving without prompting. I think it's OK to require prompt if there is only one device and the given ID is "" since having access to such a device ID should require authorization. Since the issue addressed by this bug seems sufficiently covered by the current language of the spec, I'm closing this bug. Feel free to reopen if you think we have not achieved consensus on this.