-
Notifications
You must be signed in to change notification settings - Fork 168
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
Specify different behaviors for no sink ID and the default sink ID (""). #2596
Comments
The system default is the system default. AudioContext should not do anything active with it. Specifying "" (or specifying nothing) means "always render to the user agent default device". Following what platform offers is the whole idea. If an app wants to choose a specific device, which is currently also a user-agent default - it should pick up a corresponding specific device id from device enumeration (the information is available there), rather than use "". The only difference between new AudioContext() and new AudioContext({sinkId: ""}) I personally would like to see, is that while a context created via new AudioContext() is silently falling to a null sink rendering in case there are no devices available (legacy behavior), it would be beneficial for new AudioContext({sinkId: ""}) instead of a silent failure to dispatch onerror and suspend. |
I think this is exactly what is being proposed:
|
What does
mean in the context of the default output device? The default output device always remains the default output device. It may be configured as different physical devices at different points in time, but switching the default from one physical device to another should be transparent. This is the whole idea: "use whatever is system default". What is the difference between using the default device, and using the default device "specifically"? What does "specifically" mean? What is the use case behind this wording? Note that in the comment above I'm talking about dispatching onerror when the system lost all output devices, so there is no default output device any longer. But the proposal is talking about "the current selected audio device changes", which I can only interpret as "system configuration switched to using another physical device as default". If this is not the intended meaning, it would be nice to clarify and rephrase. |
I see, yes I think they are different. I think we should discuss this with the Working Group. |
This was discussed at TPAC 2024 in the Audio WG meeting. The consensus was that AudioContext('') will behave the same as AudioContext(). WG also agreed that MediaElement should be the same. |
The place to make spec changes is here: https://webaudio.github.io/web-audio-api/#dom-audiocontext-sink-id-slot Currently it says: We should link to a definition for "default audio output device" (preferably in a different spec), but to resolve this we could simply add language that this is the same behavior as passing nothing to the constructor. |
First, the spec currently does not explain the default behavior of automatic fallback upon device change or failure. For example, if the system default audio device changes, the AudioContext doesn't do anything actively. It simply follows whatever the platform offers.
This is how the conventional AudioContext works:
However, the spec now provides a new way of selecting an output device via the context constructor, and also there's a way to specify the system default audio device. (
""
)While we were experimenting with this feature in Chromium, we thought it would be beneficial to developers to distinguish two different cases.
For the former, it should be completely backward compatible and the context will try to follow whatever the output device provided by the platform. On the other hand, the latter expresses the developer's intent to use the default audio device "specifically", thus it should follow the device selection logic as written on the spec. It means that if the current selected audio device changes, the context will be suspended and
onerror
will be dispatched.The text was updated successfully, but these errors were encountered: