Skip to main content
Skip table of contents

Insight Agent Player Agnostic Integration

Migration to the new Agent

A wrapper for the new Agent has been implemented to minimise the changes in the apps using the previous NMP Agent. The wrapper has the same available methods as the old NMP Agent:

CODE
public Agent(Context context) // constructor
void startSession(NMPVideoView xVideoView,
					ContentInfoHolder xContentInfoHolder);
void startSession(NMPVideoView xVideoView,
					ContentInfoHolder xContentInfoHolder,
					UserInfoHolder xUserInfoHolder);
void stopSession();
void setOffsetFromLive(Integer xOffsetFromLive);
void setSubtitleLanguage(String xSubtitleLanguage);
void setAudioLanguage(String xAudioLanguage)
void addAgentDispatchListener(IAgentDispatchListener listener); // Deprecated
void removeAgentDispatchListener(IAgentDispatchListener listener); // Deprecated
void removeAllAgentDispatchListeners(); // Deprecated

Additionally, since the 1.1.2 version of the wrappers, you can report custom errors using the following method:

CODE
void addErrorEvent(final Integer code, final String message)

The addAgentDispatchListener method has been deprecated; the new Agent no longer sends notifications to the IAgentDispatchListener(s).

As the previous Agent is already provided in the NMP Player SDK, it is not possible to have the same class name for the agent in the same Java package; instantiate the wrapper in the  nagra.insight.agent.wrapper package.

The configuration file used by the Agent must also be changed:

  • A new parameter, “samplingInterval” has been introduced.
  • The “reportingPeriodInitialDelay” parameter has been removed.

The samplingInterval is the time interval in seconds between the generation of one playback metrics sample and the generation of the next one. The unit for the samplingInterval and the reportingPeriod is in seconds

CODE
{
	"insightCollectorURL" : "https://collector.insight-stats.com/api/v1/",
	"samplingInterval" : "30",
	"reportingPeriodInitialDelay" : "3000",
	"reportingPeriod" : "300",
	"appName":"NMP Reference App",
	"appVersion":"1.0.0",
	"deviceType":"handheld",
	"operatorId":"a6f4abe32ac5"
}

Dependencies

The player application has further dependencies:

  • The new agent: ni-agent-x.y.z.aar

  • The NMP agent wrapper: nmp-agent-wrapper-1.0.4.aar

Reference App

A basic application is packaged in the deliverable (see download section), showing how to use the new agent with the NMP agent wrapper. The deliverable contains:

  • The NMP agent wrapper: nmp-agent-wrapper-1.0.4.zip

  • The reference app source project: nmp-reference-app

The reference app already contains the new agent, but the NMP SDK is not provided, so you can copy the SDK jar file (opy-sdk-android-4.xx.x.xxxxxxx-{production/integration}.jar) in the following folder:
nmp-reference-app/app/lib/

Since the NMP player is using native code, you will have to update your local.properties file to specify the location of the NDK:
ndk.dir=/Users/{user}/Library/Android/sdk/ndk

You should then be able to run this app on a real device.

Configuration File

Ensure you update the configuration file of the reference app with your correct operatorId and collectorUrl which can be found at:
nmp-reference-app/app/lib/src/main/res/raw/analytics.json

New Android Agent

The new Android agent can be downloaded from the Download section on the following page:

Java Agent Integration Guide

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.