SlotAdsProvider

Providers that play ads in their own renderer over the content surface (FreeWheel). Content pauses underneath; the SDK core orchestrates the session through SlotAdsHost and receives events through SlotAdsProviderCallbacks.

Contract: after startSession the provider MUST eventually call host.resumeContent() exactly once per content gate — after prerolls complete, after an empty schedule, or after a failed or timed-out ad request. Core never self-starts content and adds no hidden timeouts; the provider owns its failure modes.

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 onContentEnded()

Content reached its end — the provider plays postrolls (if any) and then calls callbacks.onAllAdsCompleted().

Link copied to clipboard
abstract fun onContentPlaybackChanged(isPlaying: Boolean)

Content play/pause state changes (drives provider video-state sync).

Link copied to clipboard
abstract fun onContentProgress(positionMs: Long, durationMs: Long)

Content progress feed (core ticker) — drives midroll triggering.

Link copied to clipboard
abstract fun onContentSeek(fromPositionMs: Long, toPositionMs: Long)

A content seek happened — drives crossed-midroll catch-up.

Link copied to clipboard
abstract fun pauseAd()

Pauses the currently playing ad slot (OGPlayer.pause() during a break).

Link copied to clipboard
abstract fun release()

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

Link copied to clipboard
abstract fun resumeAd()

Resumes the currently paused ad slot (OGPlayer.play() during a break).

Link copied to clipboard
abstract fun setAdOverlay(viewGroup: ViewGroup?)

The ViewGroup ads render into (set/cleared by the UI layer via core).

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.

Link copied to clipboard
abstract fun startSession(host: SlotAdsHost, callbacks: SlotAdsProviderCallbacks, config: AdBreakConfig)

Begins an ad session for config (the OGMediaItem.adBreaks value).

Link copied to clipboard
abstract fun stopSession()

Ends the session: stops any playing slot, unregisters listeners, disposes provider-side contexts. Idempotent.