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: "", type: "application/x-mpegurl")
let appParam = SpotXData(stringParameters: ["bundle": "", "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

YoSpace Server Side Ad integration

To configure the player to include server-side advertising from YoSpace, only the source configuration should be configured.

let typedSource = TypedSource(src: ",hlssample.m3u8?", type: StreamType.hls, ssai: YospaceServerSideAdInsertionConfiguration(streamType: .live))
let source = SourceDescription(source: typedSource)
theoplayer.source = source