Skip to main content
Version: v2

OptiView Ads SDK on Android

On Android and Android TV, the OptiView Ads SDK is a native Kotlin library that works with the OptiView Player (THEOplayer) and Media3 / ExoPlayer through player adapters, and with any other player through a custom adapter.

Prerequisites

  1. Retrieve the channel's Break Manifest URL. See Retrieving the required values.
  2. For Google Pod Serving, have your Google Ad Manager networkCode and the channel's customAssetKey at hand.
  3. Add the OptiView Ads SDK for Android to your project. Contact us for access to the SDK artifacts.

Integration

Create the SDK with an adapter around your player, then start a session with the channel's Break Manifest URL. The example below uses the OptiView Player (THEOplayer) adapter; the other adapters work the same way:

val sdk = OptiViewAds(
config = OptiViewAdsConfig(player = THEOplayerAdapter(theoPlayerView.player)),
renderer = OverlayAdRenderer(adContainer),
)

sdk.startSession(
SessionConfig(
manifestUrl = "https://us.markers.optiview.dolby.com/manifest/v1/ORG-ID/channels/CHANNEL-ID",
)
)

From this point the SDK polls the Break Manifest, schedules the breaks against your player's timeline, plays the ads, and reports the impressions. To verify the integration, schedule a break through the API or dashboard and confirm that it plays out.

Supported players

OptiView Player (THEOplayer)

The THEOplayerAdapter wraps the Player of a THEOplayerView. Ads are rendered in an overlay view stacked above your content player view.

Limitations:

  • Requires a valid THEOplayer license.

Media3 / ExoPlayer

The ExoPlayerAdapter wraps a Media3 ExoPlayer instance. Ads are rendered in an overlay view stacked above your content player view.

Limitations:

  • Requires Media3 / ExoPlayer 1.4 or later and Android 5.0 (API level 21) or later.

Custom players

Any other player can be integrated by implementing the SDK's PlayerAdapter interface, which exposes playback position, timing information, and basic playback controls. Contact us for the adapter interface reference.