w3ctag / design-reviews

W3C specs and API reviews
Creative Commons Zero v1.0 Universal
322 stars 55 forks source link

Output Device Selection in Web Audio API: AudioContext.setSinkId() #766

Closed hoch closed 1 year ago

hoch commented 1 year ago

Hello,

I'm requesting a TAG review of AudioContext.setSinkId().

AudioContext.setSinkId sets the ID of the audio device to use for output. This allows the AudioElement to route audio to a connected output device of user's choosing.

Further details:

We'd prefer the TAG provide feedback as (please delete all but the desired option): ☂️ open a single issue in our GitHub repo for the entire review

hoch commented 1 year ago

Adding @svgeesus for visibility: we initially discussed this feature is too small for TAG review, but I am requesting it here per Chrome's launch process.

svgeesus commented 1 year ago

TAG review of small, focused features is perfectly fine.

svgeesus commented 1 year ago

some useful abilities will also be included: a) an ability to specify an output device in the AudioContext’s constructor and b) an ability to specify a “silent output device” to minimize the power consumption.

A sentence motivating the user need for each of those two improvements would be a helpful addition to the explainer. Why does WebAudio API need them? Why does HTML not have them, and should it?

hoch commented 1 year ago

Thanks for the feedback, @svgeesus! I've added the "Motivation" section on the explainer. (i.e. public design doc above)

Why does HTML not have them, and should it?

For this question, I am not sure if I can answer it with confidence. For what it's worth, there's a method selectAudioOutput() under MediaDevices, but I don't think that is suitable for Web Audio API.

maxpassion commented 1 year ago

Thanks for the feedback, @svgeesus! I've added the "Motivation" section on the explainer. (i.e. public design doc above)

Why does HTML not have them, and should it?

For this question, I am not sure if I can answer it with confidence. For what it's worth, there's a method selectAudioOutput() under MediaDevices, but I don't think that is suitable for Web Audio API.

Hi @hoch, you mentioned that selectAudioOutput() is not suitable for Web Audio API, could you update the explainer document to explain the reason behind the design choices?

hoch commented 1 year ago

@maxpassion Here's my response to the question (link):

Using selectAudioOutput() under MediaDevices:

Although the Audio Output Device API spec mentions briefly about AudioContext, it lacks the detail of how Web Audio API is controlled by this method. (As of writing, no browser has implemented this feature) Additionally, the method is designed to change the audio output device for all instances of MediaElement and AudioContext in a document. Even with the implementation of selectAudioOutput(), AudioContext doesn't have the ability to set the output device separately whereas AudioElement does.

torgo commented 1 year ago

Thanks for this review request. We're happy to see this move forward and we're especially glad to see it do so with multiple stakeholder support and the attention to privacy considerations. We are slightly concerned that some of the functionality is duplicated elsewhere in the platform, however we understand the different context. Can you please move the explainer into a markdown file in the appropriate repo? 🎶

hoch commented 1 year ago

@torgo Thanks for your review! I'll move the explainer to https://github.com/WebAudio/web-audio-api.