Repository navigation
fix: await AudioContext.setSinkId when switching mixed audio output - #2276
Merged
Merged
Conversation
With webAudioMix enabled, switchActiveDevice('audiooutput') fired
AudioContext.setSinkId() without awaiting it, so the switch resolved and
emitted ActiveDeviceChanged before routing finished, and a routing
failure became an unhandled rejection while the requested device was
still reported as active.
🦋 Changeset detectedLatest commit: 92c8dff The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
size-limit report 📦
|
lukasIO
approved these changes
Nov 16, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2275 (split out from #2271).
With
webAudioMixenabled,switchActiveDevice('audiooutput', …)calledAudioContext.setSinkId()without awaiting it. The switch resolved and emittedActiveDeviceChangedbefore routing finished. If routing failed, the rejection went unhandled andgetActiveDevice('audiooutput')still reported the failed device.This change awaits the call. A routing failure now reaches the existing
catch, which restores the previousaudioOutput.deviceIdand rethrows, andActiveDeviceChangedis only emitted on success.Tests
Added two tests to
Room.test.tsthat stub the room's audio context:setSinkId: the switch doesn't resolve or emit until routing resolvessetSinkId: the switch rejects, emits nothing, and keeps the previous deviceBoth fail on
main(the second also with the unhandled rejection) and pass with the fix.🤖 Generated with Claude Code