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.
This commit is contained in:
Edison Jwa
2026-06-10 18:40:51 +09:00
parent 0a6ef55937
commit 5ef0eee3f1
+2
View File
@@ -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(),