From 5ef0eee3f19ef0baabacb8317e9f9c7d276e2a79 Mon Sep 17 00:00:00 2001 From: Edison Jwa Date: Wed, 10 Jun 2026 18:40:51 +0900 Subject: [PATCH] fix(ios): activate AVAudioSession before connect to fix voice Root cause: OSStatus 561145187 - AVAudioSession was not in .playAndRecord + .voiceChat mode when VoiceProcessingIO tried to start. Two changes: 1. Activate session BEFORE rust.connect() so it is ready when auto-join runs 2. Defensive activation in Connected handler as backup (idempotent) This fixes both the audio 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(),