Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/features/call/bloc/call_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,15 @@ class CallBloc extends Bloc<CallEvent, CallState> with WidgetsBindingObserver im

/// Triggered when the last remaining active call ends (N -> 0 active calls).
///
/// * **iOS:** Resets audio output to the default Receiver state to ensure clean state
/// for future calls, preventing state bleeding between sessions.
/// Resets platform audio routing to media profile:
/// * **iOS:** Disables speakerphone to release AVAudioSession from voice chat mode,
/// preventing state bleeding between sessions.
/// * **Android:** Clears communication device to switch from SCO (call profile)
/// back to A2DP (media profile), fixing degraded audio in YouTube/music after calls.
void _onLastCallEnded() {
_logger.info(() => 'Lifecycle: Last call ended');
if (Platform.isIOS) Helper.setSpeakerphoneOn(false);
if (Platform.isAndroid) Helper.clearAndroidCommunicationDevice();
}

void _handleSignalingSessionError({required CallServiceState previous, required CallServiceState current}) {
Expand Down