fix: recover native voice capture in background#361
Merged
Conversation
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.
Summary
AVAudioEngineafter app backgrounding, audio interruptions, route changes, and media-service resetsapplicationState,engineRunning, andlastAudioBufferAtso background capture stalls are visible on-device.mixWithOthersas well as the native voice-session pluginContext
Roger tested the merged native voice branch and found that output works in the background / locked screen, but input still stops producing usable turns after switching apps even though the iOS notch microphone indicator remains active.
This PR targets the generated native plugin source in
apps/mobile/scripts/ensure-ios-voice-session.mjs; in this worktree there is no checked-inapps/mobile/ios/App/App/CrewCmdVoiceSessionPlugin.swift, so the Swift source must be changed through the generator.Important iOS caveat: if a foreground app such as Slack or another calling/recording app owns the microphone, iOS may still prevent simultaneous background microphone capture. This PR is intended to fix/recover the CrewCMD background/locked-screen case and provide diagnostics when iOS interrupts or stalls capture.
Validation
pnpm install --frozen-lockfile --ignore-scriptspnpm lint:check -- apps/mobile/scripts/ensure-ios-audio-session.mjs apps/mobile/scripts/ensure-ios-voice-session.mjs— passed with existing repo warnings only, 0 errorspnpm typecheckcd apps/mobile && pnpm ios:audio-session && pnpm ios:voice-session && pnpm checknode --check apps/mobile/scripts/ensure-ios-audio-session.mjsnode --check apps/mobile/scripts/ensure-ios-voice-session.mjsgit diff --checkNotes
Exact generated-project identifiers preserved in the Xcode patcher path:
CCVS000000000000000001,CCVS000000000000000002,504EC3071FED79650016851F.