From 703f44d731612efe37dfbc99fe0282c6e9039157 Mon Sep 17 00:00:00 2001 From: Edison Jwa Date: Tue, 9 Jun 2026 02:16:20 +0900 Subject: [PATCH] docs(ios-audio): align activation lifecycle comments --- apps/chanora_flutter/ios/Runner/AppDelegate.swift | 7 ++++--- .../lib/services/ios_audio_session_controller.dart | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/chanora_flutter/ios/Runner/AppDelegate.swift b/apps/chanora_flutter/ios/Runner/AppDelegate.swift index 6a8461e..53a9306 100644 --- a/apps/chanora_flutter/ios/Runner/AppDelegate.swift +++ b/apps/chanora_flutter/ios/Runner/AppDelegate.swift @@ -46,7 +46,8 @@ import AVFoundation // // VoIP configuration is engaged on voice-channel join via the // `chanora/ios_audio_session` MethodChannel, driven from Dart - // by the BridgeEvent::AudioStarted / AudioStopped lifecycle. + // before `voiceJoin` starts VoiceProcessingIO and again as an + // idempotent guard on the AudioStarted lifecycle. do { try AVAudioSession.sharedInstance().setCategory(.ambient, mode: .default) logAudioSessionState(context: "launch-ambient") @@ -79,8 +80,8 @@ import AVFoundation } /// Activate the VoIP audio session. Called from Dart via the - /// `chanora/ios_audio_session` channel when a voice channel join - /// reaches the `BridgeEvent::AudioStarted` stage. Configures + /// `chanora/ios_audio_session` channel before a voice channel join + /// starts VoiceProcessingIO. Configures /// .playAndRecord + .voiceChat with .mixWithOthers so other apps /// (Spotify, podcasts) can keep playing alongside the voice /// channel — matching the Telegram group-call UX. Idempotent: diff --git a/apps/chanora_flutter/lib/services/ios_audio_session_controller.dart b/apps/chanora_flutter/lib/services/ios_audio_session_controller.dart index eb26bb2..648b171 100644 --- a/apps/chanora_flutter/lib/services/ios_audio_session_controller.dart +++ b/apps/chanora_flutter/lib/services/ios_audio_session_controller.dart @@ -10,9 +10,9 @@ const iosAudioSessionChannelName = 'chanora/ios_audio_session'; /// launch and leaves it inactive. The session is only switched to /// `.playAndRecord` + `.voiceChat` (with `.mixWithOthers`) while a /// voice channel is actually active. This controller is the Dart -/// side of that contract — call [activate] when the Rust engine -/// emits `BridgeEvent::AudioStarted` and [deactivate] on -/// `BridgeEvent::AudioStopped`. +/// side of that contract — call [activate] before the Rust engine +/// starts VoiceProcessingIO and [deactivate] on +/// `BridgeEvent::AudioStopped` or failed joins. /// /// On non-iOS platforms both methods are no-ops; the platforms /// handle their own session lifecycle elsewhere (Android via