feat(mobile): keep voice recording active across apps and threads #10140
Closedbentsignal(GitHub profile, opens in a new tab)wants to merge 4 commits into
main fromrefs/pull/10140/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/mobile/src/features/voice-input/VoiceInputProvider.tsx line 47OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +27,21 @@27+ try {28+ await setAudioModeAsync({29+ allowsRecording: false,30+ allowsBackgroundRecording: false,31+ shouldPlayInBackground: false,32+ });33+ } finally {34+ // Expo does not deactivate AVAudioSession when recording stops or its35+ // category changes. Explicit deactivation resumes interrupted app audio.36+ await setIsAudioActiveAsync(false);37+ }38+}39+40+async function configureVoiceRecordingAudio(): Promise<void> {41+ try {42+ await setAudioModeAsync({43+ allowsRecording: true,44+ interruptionMode: "doNotMix",45+ playsInSilentMode: true,46+ shouldPlayInBackground: true,47+ allowsBackgroundRecording: true,apps/mobile/src/features/voice-input/useVoiceInputController.ts line 43OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -140,18 +40,4 @@140- () => () => {141- controller.dispose();142- },143- [controller],144- ),145- );146-40+ latestInputRef.current = input;41+ });14742 useEffect(() => {148- const subscription = AppState.addEventListener("change", (nextState) => {149- // iOS reports `inactive` while its permission dialog is open. Only the150- // real background state cancels preparation; recorder status handles151- // calls and route interruptions during capture.152- if (nextState === "background") controller.appMovedToBackground();153- });154- return () => subscription.remove();155- }, [controller]);156-157- useEffect(() => () => controller.dispose(), [controller]);43+ if (ownsSession && snapshot.selection)
bentsignal(GitHub profile, opens in a new tab) changed the title
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed