AndroidAdAudioFocus

Platform AdAudioFocus over AudioManager.

The SDK plays ads on its own ExoPlayer while the content player is paused — and pausing content makes typical integrations (e.g. react-native-theoplayer's AudioFocusManager) abandon the app's focus. Without this, the whole break plays against an EMPTY focus stack: an incoming call cannot pause/duck the ad and other apps' audio mixes over it (PLAYG-458). Holding AUDIOFOCUS_GAIN with USAGE_MEDIA for the duration of the break restores normal system focus semantics to ad playback.

Constructors

Link copied to clipboard
constructor(context: Context, callbacks: AdAudioFocusCallbacks)

Functions

Link copied to clipboard
open override fun abandon(): Boolean

Give focus back (break ended, or the viewer muted the session). Idempotent.

Link copied to clipboard
open override fun request(): AdAudioFocusRequestResult

Take (or keep) media audio focus for ad playback. Idempotent.