Interface BaseAudioDevice.AudioFocusManager
- Enclosing class:
BaseAudioDevice
AudioDeviceManager.getAudioFocusManager()
.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Notifies the SDK that the audio focus has been gained.void
Notifies the SDK that the audio focus has been lost.void
setRequestAudioFocus
(boolean requestAudioFocus) Signals the audio device if audio focus is requested externally.
-
Method Details
-
setRequestAudioFocus
void setRequestAudioFocus(boolean requestAudioFocus) Signals the audio device if audio focus is requested externally. The method determines whether the SDK will automatically request audio focus, or leave that responsibility to the application (for example, when integrating with ConnectionService).On external audio focus management, Vonage SDK will not handle automatically the audio output routing. When using ConnectionServices, you should leverage the Telecom framework's built-in audio routing capabilities. The platform provides your app with a unified list of the audio routes which are available (for example,
Connection.onAvailableCallEndpointsChanged(List)
) and a standardized way to switch audio routes (for example,Connection.requestCallEndpointChange(CallEndpoint, Executor, OutcomeReceiver)
).- Parameters:
requestAudioFocus
- Whether the audio device should request audio focus. Pass in true for automatic audio focus management, or false when external (manual) activation is required, such as with ConnectionService. By default, audio focus is request internally by the SDK.Note: This method should be called early in the application's lifecycle, typically during app launch or before initiating any audio/video sessions.
-
audioFocusActivated
void audioFocusActivated()Notifies the SDK that the audio focus has been gained.This method should be called when the system (for example, via ConnectionService) has activated the audio focus. It informs the SDK that audio is now ready to be used and that the focus is active. It should be called when the
AudioManager.AUDIOFOCUS_GAIN
state is received in theAudioManager.OnAudioFocusChangeListener
or after callingAudioManager.requestAudioFocus(AudioFocusRequest focusRequest)
.Note: This method is only relevant when you call
setRequestAudioFocus(false)
. If called without requesting manual handle of audio focus, it will be ignored since the SDK handles audio focus activation automatically. -
audioFocusDeactivated
void audioFocusDeactivated()Notifies the SDK that the audio focus has been lost.This method should be called when ConnectionService has lost audio focus. It is used to inform the SDK that the audio focus is no longer active and should be reset. It should be called when the
AudioManager.AUDIOFOCUS_LOSS
state is received in theAudioManager.OnAudioFocusChangeListener
or after callingAudioManager.abandonAudioFocusRequest(AudioFocusRequest focusRequest)
.
-