Skip to content

Commit 4f8ddb6

Browse files
OMaudzaSERDUN
andauthored
fix: fixed app is locked in Bluetooth call profile after first call (#982)
* fix: fixed app is locked in Bluetooth call profile after first call Fixed situation when user returns to YouTube or music playback, the audio remains degraded, like during a call. This happens only on Android. * fix: improve comment for _onLastCallEnded to cover iOS and Android audio routing --------- Co-authored-by: Dmytro Serdun <d.serdun@webtrit.com>
1 parent 583d2d3 commit 4f8ddb6

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

lib/features/call/bloc/call_bloc.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,11 +353,15 @@ class CallBloc extends Bloc<CallEvent, CallState> with WidgetsBindingObserver im
353353

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

363367
void _handleSignalingSessionError({required CallServiceState previous, required CallServiceState current}) {

0 commit comments

Comments
 (0)