MediaPlayer Plugin Android: Difference between revisions

From Engineering Client Portal

No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Breadcrumb|}} {{Breadcrumb|Digital}} {{CurrentBreadcrumb}}
{{Breadcrumb|}} {{Breadcrumb|Digital}} {{Breadcrumb|DCR & DTVR}}  {{CurrentBreadcrumb}}
[[Category:Digital]]
[[Category:Digital]]
'''Nielsen App SDK Plugin for MediaPlayer''' interacts with Nielsen App SDK to provide with necessary data for streaming measurement based on the MediaPlayer events received.
'''Nielsen App SDK Plugin for MediaPlayer''' interacts with Nielsen App SDK to provide with necessary data for streaming measurement based on the MediaPlayer events received.


'''Supported Ad Frameworks'''
{{PluginInfobox
* Google IMA
|pluginImage=AndroidLogoIcon
|osImage=AndroidIcon
|playerVersion=Android 6+
|SDKVersion=5.1.0.4
|supportedAdFrameworks=Google IMA
|downloadLink=https://engineeringportal.nielsen.com/w/downloads/digital/plugins/native/mediaplayer/Nielsen-App-SDK-Native-Plugin-Android-1.0.0.zip
}}


== Component Diagram ==
== Component Diagram ==
Line 93: Line 100:


The data for content contains
The data for content contains
* Assetid : unique id assigned to asset
* Assetid : unique id assigned to asset (no [[Special Characters]])
* Program : program name
* Program : program name
* Title : episode title – only applicable to video content
* Title : episode title – only applicable to video content

Latest revision as of 21:20, 14 March 2018

Engineering Portal / Digital / DCR & DTVR / MediaPlayer Plugin Android

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

OS Player Version SDK Version Supported Ad Frameworks Download
{{{alt}}}
iOS
Android 6+ 5.1.0.4 Google IMA Download

Component Diagram

Component-native-andr.png

The component diagram above shows the interaction of the Plugin with various components.

App

The App is the Android application implemented by the client. The application

  • Creates the Plugin and the Player Fragment VideoView. The Player Fragment VideoView has a reference to the player.
  • Instantiates the Plugin. A reference of the application context and a JSON object containing the Nielsen AppSdk config parameters are passed during instantiation.
  • Interacts with the Plugin to provide metadata for the content and / or Ad to the Nielsen App SDK for measurement.

Plugin

The Nielsen App SDK Plugin is instantiated by the application. The Plugin

  • Initializes the NielsenAppSDK and calls the appropriate NielsenAppSDK API’s based on the events / states from the player.
  • Is also a wrapper for the Nielsen AppSDK.

IPlayerObservable

This Nielsen interface is implemented by third party players and notifies the Nielsen Plugin about the various player events / states.

IPlayerObserver

This interface is implemented by the Nielsen Plugin to subscribe to the player notification events. Events from the MediaPlayer are notified to the Plugin using the IPlayer Observerable interface. It uses the PlayerNotification object to provide the event data to the Plugin.

Nielsen AppSdk

This is the Nielsen AppSDK which handles the content and ad measurement based on the information provided by the Plugin.

MediaPlayerVideoFragmentView

This Fragment VideoView is instantiated by the Android application from the layout XML. There are 2 fragments, one for rendering the video and the other for displaying the videolist (refer VideoMetaData.java). The App should implement the IPlayerObserverable interface. Eg. VideoPlayerWithAdPlayback in MediaPlayerSampleApp receives the player events/states from MediaPlayer VideoView and passes it on to the NielsenPlugin which implements the IPlayerObserver.

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 MediePlayer: The download link for the Plugin Packages are provided with the Nielsen appid(s).
  • Test Environment Validation: Before moving the app into production, Nielsen must validate the Plugin's integration in a test environment.

Initial Configuration

Before integrating the Plugin, make sure to download the following:

Nielsen App SDK Plugin for MediaPlayer Package

The Nielsen App SDK Plugin for MediaPlayer package includes

  • The Nielsen App SDK Plugin for MediaPlayer source code and
  • The sample application source code which supports Google IMA ad Plugin.

Nielsen App SDK

Follow the steps below, to build the Nielsen Plugin and sample app in to the player application project

  • Unzip the Nielsen MediaPlayer Plugin’s zip file
  • Build the Plugin’s aar file as follows.
    • Import the module NielsenMediaPlayerPlugin into the project.
    • Create a /libs directory in NielsenMediaPlayerPlugin.
    • Copy the Nielsen AppSDK jar file in this /libs directory.
    • Build the NielsenMediaPlayerPlugin module and this should produce the NielsenMediaPlayerPlugin.aar file.
  • Build the NielsenSampleAppForMediaPlayer with the Plugin
    • Import the module NielsenSampleAppForMediaPlayer into the project.
    • Include the following in the build.gradle to compile with the MediaPlayerPlugin
      compile project(':NielsenMediaPlayerPlugin')
      
    • Build the NielsenSampleAppForMediaPlayer and this should produce the NielsenSampleAppForMediaPlayer.apk file.

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 Android SDK API Reference.

Setup

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

Nielsen App SDK Plugin Creation

The Nielsen App SDK Plugin for MediaPlayer integrates with the MediaPlayer by listening for and emitting events. It listens to events from the player and invokes the appropriate NielsenAppSdk API’s. It is also a wrapper for the Nielsen App SDK.

The App creates the Plugin as mentioned below.

plugin = new Plugin(context, config);

where:

  • context refers to the application context,
  • config contains the parameters to initialize the App SDK in the JSONObject.

Please refer to the Android SDK API Reference for more details on the App SDK configuration parameters.

Passing Metadata

The Plugin provides a public method that is used by the client to provide the metadata.

public void loadMetadata(JSONObject metadataObj)

The data for content contains

  • Assetid : unique id assigned to asset (no Special Characters)
  • Program : program name
  • Title : episode title – only applicable to video content
  • Length – length of content in seconds
  • segA – segment A will be episode title for video content
  • segB – Segment B
  • segC – Segment C

For more information on the Nielsen App SDK metadata refer to the Android SDK API Reference.

Calling the methods

The application can communicate with the Plugin for functions such as appDisable, OptIn / OptOut, static content, demographic id and OTT update via the API’s provided by the Plugin.

Function Name
AppDisable
public void appDisableApi(boolean disableApi)
OptOut Status
public boolean getOptOutStatus()
OptIn/OptOut
public String userOptOutURLString()
Demographic ID
public String getDemographicId()
Update OTT
public void updateOTT(JSONObject ottInfo)
Static Content
public void loadMetadata(JSONObject metadataObj)

For more information on these functionalities refer to the Android SDK API Reference.

Static content

StaticContent is used to provide the metadata required for measuring static content.

Static content usage

JSONObject staticMetadata = new JSONObject();
try
{
   staticMetadata.put("type","static");
   staticMetadata.put("segA","S07E04:VideoListFragment-MainActivity");
   staticMetadata.put("assetId","Static1″);
   staticMetadata.put("segB","segBStatic");
   staticMetadata.put("segC","segCStatic");
   staticMetadata.put("crossId1,"Reference1");
   staticMetadata.put("crossId2″,"Reference2");
}
catch (JSONException e)
{
   e.printStackTrace();
}
plugin.loadMetadata(staticMetadata); // Sending Static Metadata

Known Issues

Player fails to resume the video once network connectivity is resumed after network loss scenarios like Wifi ON / OFF, airplane mode ON / OFF etc. This effects the user experience but not the Nielsen measurement.

Releases

Name Version # Date Comments
Nielsen AppSDK Plugin for MediaPlayer with Google IMA ad support 1.0.0 09/23/2016 Initial version of the Nielsen App SDK Plugin for MediaPlayer with support for Google IMA ads. This Plugin can be used only with Android 6 plus. It has been tested with AppSdk build 5.1.1.7.