From 89bbfa1e18545013506c34cfcce51645ba374597 Mon Sep 17 00:00:00 2001 From: Edison Jwa Date: Wed, 10 Jun 2026 18:38:11 +0900 Subject: [PATCH] fix(ios): activate AVAudioSession before connect to fix voice Root cause: OSStatus 561145187 (!rec) - AVAudioSession was not in .playAndRecord mode when VoiceProcessingIO tried to start. Two changes: 1. Activate session BEFORE rust.connect() so it's ready when auto-join runs 2. Defensive activation in Connected handler as backup This fixes both the !rec error and the subsequent 'voice_in already taken' error that occurred after auto-join consumed voice_in on failure. --- apps/chanora_flutter/lib/main.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/chanora_flutter/lib/main.dart b/apps/chanora_flutter/lib/main.dart index 7b0036f..5c459fc 100644 --- a/apps/chanora_flutter/lib/main.dart +++ b/apps/chanora_flutter/lib/main.dart @@ -748,6 +748,7 @@ class _BetaHomeState extends State<_BetaHome> with WidgetsBindingObserver { _reconnectAttempt = null; _reconnectDelay = null; }); + unawaited(iosAudioSessionController.activate()); unawaited(_refreshSnapshot(recordActivity: false, reportErrors: true)); case rust.BridgeEvent_Lost(:final reason): _recordUiDiagnostic('connection', 'lost: $reason'); @@ -1161,6 +1162,7 @@ class _BetaHomeState extends State<_BetaHome> with WidgetsBindingObserver { _chatMessages.clear(); }); _releaseFocusedPttIfHeld(); + await iosAudioSessionController.activate(); try { final snap = await rust.connect( host: (host ?? _hostCtl.text).trim(),