JW Player Plugin iOS: Difference between revisions

From Engineering Client Portal

No edit summary
(Updating code example)
Line 55: Line 55:


Perform the following steps in the app view controller, where the player is initialized
Perform the following steps in the app view controller, where the player is initialized
* Import Plugin<syntaxhighlight lang="objective-c">#import "NielsenJWPlayerPlugin.h"</syntaxhighligh>
* Import Plugin<syntaxhighlight lang="objective-c">#import "NielsenJWPlayerPlugin.h"</syntaxhighlight>
* Add Property<syntaxhighlight lang="objective-c">@property (nonatomic, strong) NielsenJWPlayerPlugin *nielsenJWPlayerPlugin;</syntaxhighlight>Instantiate the plugin and register it with an instance of 'JWPlayerController' based on the app information provided by Nielsen.<syntaxhighlight lang="objective-c">self.nielsenJWPlayerPlugin = [[NielsenJWPlayerPlugin alloc]
 
initWithAppInfo:@{@"appid": @"MY_APP_ID",
* Add Property<syntaxhighlight lang="objective-c">@property (nonatomic, strong) NielsenJWPlayerPlugin *nielsenJWPlayerPlugin;</syntaxhighlight>
                            @"appversion": @"MY_APP_VERSION",
 
                            @"appname": @"MY_APP_NAME",
* Instantiate the plugin and register it with an instance of 'JWPlayerController' based on the app information provided by Nielsen.
                            @"sfcode": @"MY_SFCODE"};
<syntaxhighlight lang="objective-c">self.nielsenJWPlayerPlugin = [[NielsenJWPlayerPlugin alloc]
initWithPlayer: player appInfo:@
{
    @"appid": @"MY_APP_ID",
    @"appversion": @"MY_APP_VERSION",
    @"appname": @"MY_APP_NAME",
    @"sfcode": @"MY_SFCODE"
};
self.nielsenJWPlayerPlugin.dataSource = self;
self.nielsenJWPlayerPlugin.dataSource = self;
self.player.delegate = self.nielsenJWPlayerPlugin;</syntaxhighlight>
self.player.delegate = self.nielsenJWPlayerPlugin;
* Implement 'NielsenJWPlayerDataSource' delegate by adding the method as mentioned below:<syntaxhighlight lang="objective-c">– (NSDictionary *)contentMetadata;</syntaxhighlight>Plugin will call this method to fetch content metadata for the video.
</syntaxhighlight>
* Implement 'NielsenJWPlayerDataSource' delegate by adding the method as mentioned below:
<syntaxhighlight lang="objective-c">– (NSDictionary *)contentMetadata;</syntaxhighlight>
Plugin will call this method to fetch content metadata for the video.


Refer to the Reference Guide 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.
Refer to the Reference Guide 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):<syntaxhighlight lang="objective-c">– (NSDictionary *)channelInfo;</syntaxhighlight>
* Add the following line of code (optional):
<syntaxhighlight lang="objective-c">– (NSDictionary *)channelInfo;</syntaxhighlight>
Plugin calls this method to request for channel information associated with the video.
Plugin calls this method to request for channel information associated with the video.



Revision as of 21:10, 26 July 2017

Engineering Portal / Digital / DCR & DTVR / JW Player Plugin iOS

Nielsen App SDK Plugin for JW Player interacts with Nielsen App SDK to provide with necessary data for streaming measurement based on the SDK events received from the JW Player SDK.

Supported Ad Frameworks

  • VAST

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 for JW Player: The download link for the Plugin Packages are provided with the Nielsen appid(s).
  • JWPlayer SDK for iOS
  • 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 App SDK Plugin for JWPlayer, which includes:
    • Plugin Implementation Guide (this document)
    • The Nielsen App SDK Plugin for JWPlayer source code and
    • The sample application source code which supports JWPlayer VAST 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

The steps for setting up the Nielsen App SDK Plugin for JWPlayer are as follows

Nielsen App SDK Plugin Package Installation

For FreeWheel ad support

  • Unzip the NielsenJWPlayerPluginForiOS.zip
  • Copy "NielsenAppApi.Framework" to the NielsenJWPlayerPluginForiOS/NielsenSampleAppVast folder.
  • Download JWPlayer SDK from https://dashboard.jwplayer.com/#/players/downloads. The plugin has been tested with version 2.1.0.
  • Copy "JWPlayer-iOS-SDK.framework" to the "NielsenJWPlayerPluginForiOS/NielsenSampleAppVast" folder
  • Drag and drop "NielsenAppApi.Framework" and "JWPlayer-iOS-SDK.framework" to NielsenSampleAppVast project. Make sure frameworks are linked under Build Phases → Link Binary with Libraries
  • click '+' sign and add "NielsenAppApi.Framework" and "JWPlayer-iOS-SDK.framework"
  • Build the app within the plugin

Nielsen App SDK Plugin Creation

The Nielsen App SDK Plugin for JWPlayer integrates with the JWPlayer SDK by listening for events from the player, other plugins and emits events for the player. It is also a wrapper for the Nielsen App SDK. It is registered with the JWPlayer SDK when it is instantiated by the application.

Perform the following steps in the app view controller, where the player is initialized

  • Import Plugin
    #import "NielsenJWPlayerPlugin.h"
    
  • Add Property
    @property (nonatomic, strong) NielsenJWPlayerPlugin *nielsenJWPlayerPlugin;
    
  • Instantiate the plugin and register it with an instance of 'JWPlayerController' based on the app information provided by Nielsen.
self.nielsenJWPlayerPlugin = [[NielsenJWPlayerPlugin alloc]
initWithPlayer: player appInfo:@
{
    @"appid": @"MY_APP_ID",
    @"appversion": @"MY_APP_VERSION",
    @"appname": @"MY_APP_NAME",
    @"sfcode": @"MY_SFCODE"
};
self.nielsenJWPlayerPlugin.dataSource = self;
self.player.delegate = self.nielsenJWPlayerPlugin;
  • Implement 'NielsenJWPlayerDataSource' delegate by adding the method as mentioned below:
 (NSDictionary *)contentMetadata;

Plugin will call this method to fetch content metadata for the video.

Refer to the Reference Guide 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 *)channelInfo;

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.

  • Add the following line of code to notify App SDK that the remote OTT device (like Google ChromeCast, Roku, Amazon FireTV, etc.) is connected / disconnected (change of OTT status).

Refer to the Digital Measurement Onboarding in the Nielsen SDK Documentation for more information and example.

Opt-Out

The app needs to provide a way for the user to optout of metering. This is done by displaying Opt-Out page and passing the user's response back to Nielsen, as described in the Digital Measurement Onboarding of the Nielsen SDK Documentation. The plugin exposes the 'NielsenAppApi', userOptOut and optOutURLString methods that are needed to interact with Opt-Out page.

-(BOOL)optOutStatus;

This API gets the current Nielsen opt-out state of AppSDK. Call this API to retrieve the Opt-Out or Opt-In state. Refer to the Digital Measurement Onboarding in the Nielsen SDK Documentation for more information and example.

SampleApp

Check NielsenJWPlayerSampleApp (NielsenJWPlayerSampleApp.tar.gz) to know about the usage of plugin and the Opt-Out page.

Releases

Name Version # Date Comments
Nielsen AppSDK Plugin for JWPLayer (VAST) 1.0.0 03/02/2016 Initial version of the Nielsen App SDK Plugin for JWPlayer (iOS) with support for VAST ads.
Nielsen AppSDK Plugin for JWPLayer (VAST) 1.1.0 06/20/2016 Reflects changes as per latest Nielsen App SDK v5.1.0.5