@@ -44,8 +44,6 @@ class RtcMediaDeviceNotifier {
4444 /// [onInterruptionStart] is called when the call interruption begins.
4545 /// [onInterruptionEnd] is called when the call interruption ends.
4646 /// [androidInterruptionSource] specifies the source of the interruption on Android.
47- /// [androidAudioAttributesUsageType] and [androidAudioAttributesContentType] allow you to specify
48- /// the audio attributes that will be used when requesting audio focus.
4947 ///
5048 /// On iOS, interruptions can occur due to:
5149 /// - Incoming phone calls
@@ -71,15 +69,19 @@ class RtcMediaDeviceNotifier {
7169 void Function ()? onInterruptionEnd,
7270 rtc.AndroidInterruptionSource androidInterruptionSource =
7371 rtc.AndroidInterruptionSource .audioFocusAndTelephony,
72+ @Deprecated (
73+ 'Audio focus is now handled in a way that does not require this parameter. It will be removed in the next major version.' ,
74+ )
7475 rtc.AndroidAudioAttributesUsageType ? androidAudioAttributesUsageType,
76+ @Deprecated (
77+ 'Audio focus is now handled in a way that does not require this parameter. It will be removed in the next major version.' ,
78+ )
7579 rtc.AndroidAudioAttributesContentType ? androidAudioAttributesContentType,
7680 }) {
7781 return rtc.handleCallInterruptionCallbacks (
7882 onInterruptionStart,
7983 onInterruptionEnd,
8084 androidInterruptionSource: androidInterruptionSource,
81- androidAudioAttributesUsageType: androidAudioAttributesUsageType,
82- androidAudioAttributesContentType: androidAudioAttributesContentType,
8385 );
8486 }
8587
@@ -173,4 +175,26 @@ class RtcMediaDeviceNotifier {
173175 Future <void > triggeriOSAudioRouteSelectionUI () {
174176 return rtc.Helper .triggeriOSAudioRouteSelectionUI ();
175177 }
178+
179+ /// Temporarily mutes all audio output (playout) from the app.
180+ /// This does not affect the microphone or remote track subscriptions.
181+ /// Use as a global "mute all sounds" toggle or when the app goes to background.
182+ Future <void > pauseAudioPlayout () {
183+ return rtc.Helper .pauseAudioPlayout ();
184+ }
185+
186+ /// Resumes audio output (playout) muted via [pauseAudioPlayout] .
187+ /// Does not change microphone state or remote track subscriptions.
188+ Future <void > resumeAudioPlayout () {
189+ return rtc.Helper .resumeAudioPlayout ();
190+ }
191+
192+ /// Regains Android audio focus if it was lost.
193+ ///
194+ /// Note: On Android, audio focus may not be restored automatically.
195+ /// To ensure you receive `onInterruptionEnd` , explicitly call
196+ /// [resumeAudioPlayout] (e.g., when the app resumes from background).
197+ Future <void > regainAndroidAudioFocus () {
198+ return rtc.Helper .regainAndroidAudioFocus ();
199+ }
176200}
0 commit comments