Adverts with Google IMA

The Player SDK for FPS is designed to be easily extendable through 3rd party components.

One of these components, called IMAWrapper, is a wrapper for the Google Interactive Media Ads (IMA) framework, which supports linear advertisements in conjunction with content played via the SDK. This page explains the steps you need to follow to implement and integrate, together with code examples. It should be used alongside the supplied example application, dynamic-ads-ima.

Adverts are only supported on iOS and not on tvOS.

Prerequisites

  • An ad server already configured and knowledge of the ad tag URLs that will be used to access it.

  • An understanding of the CocoaPods technology, see Using CocoaPods.

  • A working integration of the Nagra OpenTV Player FPS SDK for iOS (the dynamic-ads-ima example code).

  • A device to show the content – a handheld device supporting iOS 11 or above.

  • A valid licence in the application bundle, see Integration Guide: Player licence

Procedure

The process is split into two stages:

  • Installing the IMA CocoaPods pod

  • Enabling playback of linear adverts

Installing the IMA CocoaPods pod

The dynamic-ads-ima example application includes a pod file so you may skip to step 3. If you want to do the pod integration from scratch, follow from step 1.

  1. Install cocoapods by running the following command:

    sudo gem install cocoapods
    
  2. Create your app's podfile in the project's root folder by running pod init and add the IMA pod dependency, which should look something like this:

    target '<target_name>' do
    use_frameworks!
    source 'https://github.com/CocoaPods/Specs.git'
    platform :ios, '9.0'
    pod 'GoogleAds-IMA-iOS-SDK', '~> 3.9'
    end
    
  3. To apply this into your project execute the following command in the project's root folder (where the Xcode project file is located):

    pod install  --repo-update
    

    The --repo-update switch is only required if you need the pod details to be reflected back into the corresponding project workspace files, for example the first time it has ever been run.

There will now be a .xcworkspace configured with the IMA Pod linking capability. You must use this instead of the .xcodeproj.

Next step: Enable playback of linear adverts