Skip to main content
Version: 11.7.0

Google Dynamic Ad Insertion (DAI) on iOS

Google Dynamic Ad Insertion (DAI) is a Server-Side Ad-Insertion solution offered by Google where THEOplayer offers playback for HLS and DASH streams.

Prerequisites

To use Google DAI with the THEOplayer iOS SDK, the THEOplayer GoogleIMA Integration should be integrated. For instructions on installation, importing and adding the integration, please refer to this guide.

Usage

Define a GoogleDAITypedSource and a GoogleDAIVodConfiguration to pass to theoplayer's source:

let daiConfig = GoogleDAIVodConfiguration(videoID: "tears-of-steel", contentSourceID: "2548831", apiKey: "", authToken: nil, streamActivityMonitorID: nil, adTagParameters: nil)
let typedSource = GoogleDAITypedSource(ssai: daiConfig)
theoplayer.source = SourceDescription(source: typedSource)

or

let daiConfig = GoogleDAILiveConfiguration(assetKey: "c-rArva4ShKVIAkNfy6HUQ", apiKey: "", authToken: nil, streamActivityMonitorID: nil, adTagParameters: nil)
let typedSource = GoogleDAITypedSource(ssai: daiConfig)
theoplayer.source = SourceDescription(source: typedSource)

And THEOplayer will take care of the rest.

Additional DAI APIs can be found on the imaIntegration.dai endpoint.

Resources