Skip to main content
Version: v2

OptiView Ads on iOS

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

Prerequisites

  1. Obtain an OptiView Player license compatible with OptiView Ads from the player portal.
  2. Add THEOplayer-Integration-THEOads to your project.
pod 'THEOplayer-Integration-THEOads', '~> 11.6.1'
  1. Add Google IMA. CocoaPods uses GoogleAds-IMA-iOS-SDK; SwiftPM uses the GoogleInteractiveMediaAds product.

    Screenshot of Xcode file menu for Google IMA

    Screenshot of SwiftPM menu for Google IMA

    Screenshot of SwiftPM Google product selection

Integration

import THEOplayerSDK
import THEOplayerTHEOadsIntegration

let theoads = THEOadsIntegrationFactory.createIntegration(on: theoplayer)
theoplayer.addIntegration(theoads)

let typedSource = TypedSource(
src: "CHANNEL-MONETIZED-HLS-URL",
type: "application/x-mpegurl",
hlsDateRange: true
)
let theoad = THEOAdDescription(
networkCode: "NETWORK-CODE",
customAssetKey: "CUSTOM-ASSET-KEY",
breakManifestUrl: URL(string: "https://ADS-HOST/manifest/v1/ORG-ID/channels/CHANNEL-ID"),
adTagParameters: ["key": "value"]
)
theoplayer.source = SourceDescription(source: typedSource, ads: [theoad])

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

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