Skip to main content
Version: v2

OptiView Ads on Android

This guide configures OptiView Ads in the OptiView Player Android SDK 11.x.

Prerequisites

  1. Obtain an OptiView Player license compatible with OptiView Ads from the player portal.
  2. Add the OptiView Player Android SDK by following the Android getting started guide.
  3. Add the integration in your module-level Gradle file.
dependencies {
implementation "com.theoplayer.theoplayer-sdk-android:core:11.+"
implementation "com.theoplayer.theoplayer-sdk-android:integration-ads-theoads:11.+"
}

Integration

val theoAdsIntegration = TheoAdsIntegrationFactory.createTheoAdsIntegration(theoPlayerView)
theoPlayerView.player.addIntegration(theoAdsIntegration)

theoPlayerView.player.source = SourceDescription.Builder(
TypedSource.Builder("CHANNEL-MONETIZED-HLS-URL")
.type(SourceType.HLS)
.hlsDateRange(true)
.build()
).ads(
TheoAdDescription(
networkCode = "NETWORK-CODE",
customAssetKey = "CUSTOM-ASSET-KEY",
breakManifestUrl = "https://ADS-HOST/manifest/v1/ORG-ID/channels/CHANNEL-ID",
adTagParameters = mapOf("key" to "value")
)
).build()

breakManifestUrl points to the v2 Break Manifest. hlsDateRange(true) enables handling of the SSAI cues in the channel's monetized HLS media playlist.

Integrating with Open Video UI

Create and add TheoAdsIntegration before creating your UI, then use the same SourceDescription configuration above with Open Video UI for Android.

Verify

Load the channel's monetized HLS source and start playback. Confirm that the Break Manifest or SSAI cues schedule a break, the ad renders, and the OptiView impression appears in the portal.

More information