Repository navigation
fix: release the microphone when disconnect runs during the permission prompt - #445
Open
RaphaelFakhri wants to merge 1 commit into
Open
RaphaelFakhri wants to merge 1 commit into
RaphaelFakhri wants to merge 1 commit into
Conversation
Contributor
|
@RaphaelFakhri is attempting to deploy a commit to the Hume Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
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.
Fixes the microphone staying open when
disconnect()runs whileconnect()is still waiting forgetUserMediato resolve.disconnectAndCleanUpResourcescallsstopStream(), but at that pointuseMicrophoneStreamhas no stream to stop. When the permission prompt is later accepted,getStreamstores the new stream andconnect()continues: it creates a sharedAudioContextand only notices the cancellation at the next check, which returns without releasing either resource. The browser keeps the microphone indicator on and theAudioContextstays open until the page unloads.This change checks
checkShouldContinueConnecting()right aftergetStreamresolves. If the attempt was canceled, it stops the stream and returns before creating theAudioContext.Testing
VoiceProvider.disconnect-while-connecting.test.tsx. It startsconnect()with agetUserMediapromise that stays pending, callsdisconnect(), resolves the stream, and checks that the track is stopped and that noAudioContextis created.pnpm vitest runinpackages/reactpasses (27 tests).pnpm lintreports no errors.