Interactive Media Ads for iOS
This document describes the steps required for adding support for the IMA Plugin functionality on iOS devices. IMA (or Interactive Media Ads) was developed by Google to enable you to display ads in your application’s video, audio, and game content. To learn more about Google’s IMA, see Google’s IMA developer’s site.
Supported IMA SDK Version is: 3.5.2
Common Issues
- There is currently an open issue with IMA SDK where removing the player view before destroying the ads manager will cause an error on the next ad playback. To fix the issue all you have to do is call the
player.destroy()
beforeplayer.removeFromSuperview()
If you get below error:
Please make sure that the order of removing player on your side is:
- When not including ads, the PlayerEvent observed events start occurring after calling prepare().
When including ads, none of the PlayerAd events occur after calling prepare().
To resolve this issue and get autoPlay
with ads please make sure to call play() before those events start occurring.
Enable IMA Plugins for the Kaltura Video Player
To enable the IMA Plugin on iOS devices for the Kaltura Video Player, add the following line to your Podfile:
Control Ad Play
To control ad play during runtime, implement the following Video Player delegate method:
Register the IMA Plugin
Next, register the IMA Plugin inside your application as follows:
Configure the Kaltura Video Player to Use the IMA Plugin
To configure the player to use IMA Plugin, add the following configuration to your PlayerConfig
file as follows:
Configure Clickthroughs
The IMA Plugin offers two options for opening ad landing pages:
- Via an in-app browser
- Via Safari
By default, the plugin will open pages using Safari. To update the plugin to use an in-app browser, you’ll need to set the webOpenerPresentingController
value in the AdsConfig object as follows:
Add Companion Ads
To see companion ads in the device, you’ll need to implement the following steps:
- Configure an ad tag to return a companion ad (prepare this in advance).
- Supply a companion ad container to the plugin using the following format (make sure the size of the companion being returned is the same size as the UIView in which you’re trying to display it):
Specify the Desired Bitrate and Video Formats
The IMA Plugin enables you to specify the video formats and bitrate using the following configuration:
Specify the Localized Ad Language
The IMA Plugin enables you to specify the language to be used to localize ads and the Video Player UI controls.
To do so, set the language parameter of the AdsConfig to the appropriate language code using this reference.
Listen to Ad Events
Use the following code to listen to ad events:
Ad Info Event
To observe ad info when an ad is starting use the following:
Ad Cue Points Event
To observe ad cue points update use the following:
Have Questions or Need Help?
Check out the Kaltura Player SDK Forum page for different ways of getting in touch.