Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to choose the output device? #999

Open
aaronvg opened this issue Jan 24, 2023 · 2 comments
Open

How to choose the output device? #999

aaronvg opened this issue Jan 24, 2023 · 2 comments

Comments

@aaronvg
Copy link

aaronvg commented Jan 24, 2023

Chromium seems to have added support to choose the output device (see WebAudio/web-audio-api#2498)

Are there any plans to add setSinkId to this library?

Could I just cast the AudioContext object from this library into the native one and call that method? Or maybe the other way around -- cast a native AudioContext to the standardized one? Or what's the best way of accessing the native AudioContext?

@chrisguttandin
Copy link
Owner

Hi @aaronvg,

thanks for creating this issue. My current thinking is that it could probably be implemented in a standards compliant way with very minimal effort.

audioContext.sinkId would always return '' since that is the default. And any call to audioContext.sinkId() would throw a NotSupportedError in those browsers that don't implement it.

The spec also includes a step to check the 'speaker-selection' permission but this seems to be in no browser so far.

Does that sound about right?

@baparham
Copy link

baparham commented Feb 8, 2023

I've got my eyes on this one, since I'd love to be able to "natively" choose the output device in higher level libraries like Tone.js without needing to go through extra steps like outlined in Tonejs/Tone.js#877

I would expect audioContext.sinkId to return the currently assigned sinkId which could be '' if you haven't explicitly set it via audioContext.setSinkId(...) right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants