iOS SDK Ads

SpotX pre-integration

To configure the player to play SpotX ads, Google IMA should be configured.

let playerConfig = THEOplayerConfiguration(googleIMA: true)
var theoplayer = THEOplayer(configuration: playerConfig)

Next add a SpotX ad configuration to the sources

Note: from SDK ≥ 1.6.2 the 'ifa' parameter is automatically added in the SDK, so you don't need to specify it manually anymore.

let typedSource = TypedSource(src: "https://www.examples.com/index.m3u8", type: "application/x-mpegurl")
let appParam = SpotXData(stringParameters: ["bundle": "my.bundle.name", "name": "MyAppName"])
let deviceParam = SpotXData(stringParameters: ["ifa": "38400000-8cf0-11bd-b23e-10b96e40000d"], intParameters: ["dnt": 1, "lmt": 1], geoParameter: Geo(lat: -24.378528, lon: -128.325119))
let custom = SpotXData(stringParameters: ["my-custom-label": "my-custom-value"]) let adDesc = SpotXAdDescription(id: "12345", cacheBuster: true, app: app, device: device, user: user, custom: custom)
let source = SourceDescription(source: typedSource, ads: [adDesc])
theoplayer.source = source