AVPlayer Plugin iOS
From Engineering Client Portal
Nielsen App SDK Plugin for Native Player brings Nielsen metering in to AVPlayer player for iOS platform.
OS | Player Version | SDK Version | Supported Ad Frameworks | Download | |
---|---|---|---|---|---|
Xcode 8.2.1 | 5.1.0.5 | FreeWheel and Google IMA | Download |
Plugin Implementation
Pre-requisites
- Nielsen SDK Configuration Form: Complete this form to receive the appid(s). The information on this form is required to set up the Content Management System (CMS) mapping for the app.
- Nielsen App ID (appid): A unique ID that Nielsen assigns to the site / player.
- Nielsen App SDK Plugin: The download link for the Plugin Packages are provided with the Nielsen appid(s).
- Nielsen App SDK: Please see Digital Downloads for the latest Nielsen App SDK.
- Test Environment Validation: Before moving the app into production, Nielsen must validate the Plugin’s integration in a test environment.
Initial Configuration
Before integrating our Plugin, make sure to download the following:
- Nielsen Plugin Package, which includes:
- Plugin Implementation Guide (this document)
- The Nielsen App SDK Plugin for Native AVPlayer source code and
- The sample application source code which supports FreeWheel and Google IMA ad Plugin.
Initialization with Global Parameters
To initialize the Plugin that initializes the App SDK, pass the global parameters in JSON string format. Some of the global parameters are
- Nielsen App ID (appid)
- appversion
- appname
- sfcode
- dma
- ccode
- CMS Metadata
For more details refer to the Nielsen iOS SDK API Reference.
Setup
Nielsen App SDK Plugin Package Installation
For FreeWheel ad support
- Unzip the NielsenAVPLayerPluginForiOS.zip.
- Copy “NielsenAppApi.Framework” to the NielsenAVPLayerPluginForiOS/NielsenSampleApp folder.
- Import AVFoundation framework to the NielsenAVPLayerPluginForiOS/NielsenSampleApp folder
- The FreeWheel SDK is not included in this pod. The FreeWheel SDK AdManager.framework must be added manually to the project. The pod will however add all the libraries required by AdManager.framework.
- Drag and drop both “NielsenAppApi.Framework” and “AVPLayerPlugin” to NielsenSampleApp project. Make sure frameworks are linked under Build Phases → Link Binary with Libraries.
- Click ‘+’ sign and add “NielsenAppApiFramework” and “AdManagerSupport.framework”.
- Build the app within the plugin.
For Google IMA ad support
- Unzip the NielsenAVPLayerPluginForiOS.zip and import the AVPLayer Plugin folder.
- Copy “NielsenAppApi.Framework” to the project or sample app.
- Download IMA iOS SDK from Google webpage (https://developers.google.com/interactive-media-ads/docs/sdks/ios/download). The plugin has been tested with version 3.
- Copy “GoogleInteractiveMediaAds.framework” to the “NielsenAVPLayerPluginForiOS/NielsenSampleAppGoogleIMA” folder
- Copy “AVFoundation framework” to the “NielsenAVPLayerPluginForiOS” folder
- Drag and drop “NielsenAppApi.Framework”, “AVPLayerPlugin” and “GoogleInteractiveMediaAds.framework” to NielsenSampleApp project. Make sure frameworks are linked under Build Phases → Link Binary with Libraries.
- Click ‘+’ sign and add “NielsenAppApi.Framework” and “GoogleInteractiveMediaAds.framework”.
- Build the app within the plugin.
Nielsen App SDK Plugin Creation
The Nielsen App SDK Plugin for AVPLayer integrates with the AVPLayer SDK by listening for and emitting events. It listens to events from the player and from other plugins and emits events for the player. It is also a wrapper for the Nielsen App SDK. It is registered with the Brightcove SDK when it is instantiated by the application.
Perform the following in the app view controller, where the player is initialized.
- Import plugin
#import <NielsenAVPLayerPlugin/NielsenAVPLayerPlugin.h>
- Add propertyInstantiate the plugin and register it with an instance of ‘AVPLayerPlaybackController’ based on the app information provided by Nielsen.
@property (nonatomic, strong) NielsenAVPLayerPlugin *avPLayerPlugin;
self.avPLayerPlugin = [[NielsenAVPLayerPlugin alloc] initWithAppInfo:@{@”appid”: @”MY_APP_ID”, @”appversion”: @”MY_APP_VERSION”, @”appname”: @”MY_APP_NAME”, @”sfcode”: @”MY_SFCODE”};
- Implement ‘NielsenAVPLayerDataSource’ delegate by adding the methods mentioned below:
-(NSDictionary*)contentMetadataForPlayerItem:(AVPlayerItem *)playerItem; -(NSMutableDictionary *)adMetadata;
Plugin calls this method to fetch content metadata for the video.
Refer to the Digital Measurement Onboarding in the Nielsen SDK Documentation on the exact format of this dictionary. Set any key-value pair from the content metadata with an exception of ‘length’, ‘type’ and ‘title’, which are pre-set already.
Add the following line of code (optional):
– (NSDictionary*)channelInfoForPlayerItem:(AVPlayerItem *)playerItem;
Plugin calls this method to request for channel information associated with the video.
Refer to the Digital Measurement Onboarding in the Nielsen SDK Documentation on the exact format of this dictionary.
Opt-Out
The application needs to provide a way for user to optout of metering. This is done by displaying opt-out page and passing the response from user back to Nielsen. The plugin exposes the ‘NielsenAppApi’ userOptOut and optOutURL methods to interact with opt-out page.
SampleApp
Check NielsenAVPLayerSampleApp to know about the usage of plugin and the Opt-Out page.
Releases
Name | Version # | Date | Comments |
---|---|---|---|
Nielsen AppSDK Plugin for AVPLayer (FreeWheel & Google IMA) | 1.0.0 | 07/16/2016 | Initial version of the Nielsen App SDK Plugin for AVPLayer (iOS) with Nielsen App SDK version v5.1.0.5 and support for FreeWheel & Google IMA ads. |