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.
This commit is contained in:
@@ -748,6 +748,7 @@ class _BetaHomeState extends State<_BetaHome> with WidgetsBindingObserver {
|
|||||||
_reconnectAttempt = null;
|
_reconnectAttempt = null;
|
||||||
_reconnectDelay = null;
|
_reconnectDelay = null;
|
||||||
});
|
});
|
||||||
|
unawaited(iosAudioSessionController.activate());
|
||||||
unawaited(_refreshSnapshot(recordActivity: false, reportErrors: true));
|
unawaited(_refreshSnapshot(recordActivity: false, reportErrors: true));
|
||||||
case rust.BridgeEvent_Lost(:final reason):
|
case rust.BridgeEvent_Lost(:final reason):
|
||||||
_recordUiDiagnostic('connection', 'lost: $reason');
|
_recordUiDiagnostic('connection', 'lost: $reason');
|
||||||
@@ -1161,6 +1162,7 @@ class _BetaHomeState extends State<_BetaHome> with WidgetsBindingObserver {
|
|||||||
_chatMessages.clear();
|
_chatMessages.clear();
|
||||||
});
|
});
|
||||||
_releaseFocusedPttIfHeld();
|
_releaseFocusedPttIfHeld();
|
||||||
|
await iosAudioSessionController.activate();
|
||||||
try {
|
try {
|
||||||
final snap = await rust.connect(
|
final snap = await rust.connect(
|
||||||
host: (host ?? _hostCtl.text).trim(),
|
host: (host ?? _hostCtl.text).trim(),
|
||||||
|
|||||||
Reference in New Issue
Block a user