AdsProvider

interface AdsProvider

SPI base for ad-insertion implementations. Apps construct a provider from an ads module and pass it to OGPlayer.Builder.setAdsProvider — exactly one provider per player. Providers come in two styles:

  • TimelineAdsProvider: ads are spliced into the Media3 timeline and the content engine plays them (ImaAdsProvider). Configured per item with AdTagConfig.

  • SlotAdsProvider: the provider plays ads in its own renderer over the content surface while content pauses underneath (FreeWheel). Configured per item with the module's own AdBreakConfig implementation.

Inheritors

Functions

Link copied to clipboard
open fun clickAd()

Opens the current ad's clickthrough, firing the provider's click tracking. Default no-op (IMA renders and handles its own click UI).

Link copied to clipboard
open fun focusUi(): Boolean

Remote-control UIs: moves the provider's OWN focus onto its interactive elements — IMA: the skip button when present, else its icons ("About this ad") — so a D-pad can operate them. Returns false when the provider has no such UI. Called by the SDK's TV chrome on a deliberate step.

Link copied to clipboard
abstract fun release()

Releases all provider resources. Called from OGPlayer.release().

Link copied to clipboard
open fun setAdVolume(volume: Float, muted: Boolean)

The viewer changed the volume while this provider's ad is on screen. A provider that renders the creative in its OWN surface (FreeWheel) must apply it there — the content engine is held under the break, so changing its volume is inaudible. Default no-op: a provider whose ads play in the content engine (IMA) already follows it.

Link copied to clipboard
open fun skipAd()

Skips the currently playing ad, if any and if it is skippable. Whether a programmatic skip is honored is provider-dependent.