Skip to main content

IMA Plugin

TV platforms

tvOS

DIVA Google IMA Plugin​

The DIVA Google IMA plug-in is an out-of-the-box implementation for Google Interactive Media Ads (IMA) that makes it easy to integrate multimedia ads into your app. There are two ways to implement IMA:

  • IMA Client-Side: which combines ad and content video within your app. Ads play in a separate video player positioned on top of the Diva video player. For more information see below.
  • IMA dynamic ad insertion (DAI): which combines ad and content video on the Ad Manager servers, and then returns a single video stream to Diva for playback. For more information see below.

For more information on how to pass extra information (e.g. tag or imaid) to Diva player see advertising.

Installation​

IMA Plugin is distributed via SPM package found here. A VXP GitHub account is required to gain access.

Plugin uses Google's SDK and it is marked as a dependency by the package.

Usage​

IMA Client-Side​

To let know Diva player that you want to start using the plug-in, just pass an initialized class of ImaClientSideProvider() in DivaTVConfiguration.imaClientSideHandler. If nil, Diva Player understands it should be disabled.

An example is shown below:

import DivaImaAdvertisement

var divaConfiguration = DivaTVConfiguration(
dictionary: dictionary,
settings: settingsCleanModel,
videoId: "videoId_fravscro",
videoMetadataProvider: videoMetadataProvider,
imaClientSideProvider: ImaClientSideProvider()
)

IMA dynamic ad insertion (DAI)​

To let know Diva player that you want to start using the plug-in, just pass an initialized class of ImaDaiProvider() in DivaTVConfiguration.imaDaiProvider. If nil, Diva Player understands it should be disabled.

DivaTVConfiguration.imaDaiAdTagParameters allows you to override a limited set of IMA DAI ad tag parameters on your stream request. More information in Google IMA DAI SDK for tvOS documentation

An example is shown below:

import DivaImaAdvertisement

var divaConfiguration = DivaTVConfiguration(
dictionary: dictionary,
settings: settingsCleanModel,
videoId: "videoId_fravscro",
videoMetadataProvider: videoMetadataProvider,
imaDaiProvider: ImaDaiProvider(),
imaDaiAdTagParameters: ["npa" : "1"]
)