Class NielsenPlugin
The latter is important because the plugin can not track application lifecycle fully, so you need to integrate the callbacks when you application goes to background. The foreground callback is triggered automatically when the player view component is registered.
Before you can use this plugin, you have to register it with the SDK:
PlayerSDK.register(new NielsenPlugin(...));
PlayerSDK.init(getApplicationContext());
The plugin constructor takes either the mandatory parameters that are required for the Nielsen
SDK, or you can pass a JSONObject. In the latter case, please make sure that you configure and
setup the mandatory Nielsen parameters in the JSONObject manually.
Once registered, the NielsenComponent
will be exposed by the PlayerView
. The
internals of that component will make sure that the Nielsen SDK is created and initialized and that
playback data is forwarded correctly. You can however access the Nielsen AppSdk through that
component to add additional lifecycle calls (i.e. app goes to background) or integrate the
opt-in or opt-out support. Here is an example how you can access the component:
NielsenComponent nielsenComponent = playerView.getComponent(NielsenComponent.class);
if (nielsenComponent != null && nielsenComponent.getAppSdk() != null) {
nielsenComponent.getAppSdk().appInForeground(this);
}
The integration uses the AnalyticsMetaData
extract and provide
additional information downstream. The channel information contains the playback URL and
uses the AnalyticsMetaData.assetId
as the "channelName".
The content meta data will contain all keys in the AnalyticsMetaData.extra
bundle and will always set the "assetId" and the "length" based on AnalyticsMetaData.assetId
and AnalyticsMetaData.durationSeconds
unless they are already
defined in the extras. The duration for VoD (i.e. non live) content is also taken from the
player controller if not specified in the analytics meta-data.
Besides the NielsenComponent
, the plugin does also expose the instance of the AppSdk. This
can be used for instance to handle opt-in/opt-out requests outside of playback. You can access
the plugin dynamically after it was registered:
NielsenPlugin nielsenPlugin = PlayerSDK.getPlugin(NielsenPlugin.class);
AppSdk appSdk = nielsenPlugin.getAppSdk();
...
- Since:
- 4.2.0
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
JSON Object configuration key for the app IDstatic final String
JSON Object configuration key for the app namestatic final String
JSON Object configuration key for the app versionstatic final String
JSON Object configuration key for the app SF Codestatic final String
The SF code for DCR -
Constructor Summary
ConstructorDescriptionNielsenPlugin
(String appId, String appName, String appVersion, String sfCode) Create a new instance of the plugin with the given app id, app name and sf code that will be passed to the Nielsen SDK.NielsenPlugin
(JSONObject configuration) Create a new instance of the plugin using the given JSON Object to configure the Nielsen SDK -
Method Summary
Modifier and TypeMethodDescriptionReturns the instance of the App SDKgetId()
void
setEnabled
(boolean enabled) Dynamically enable or disable nielsen integration for playbacksMethods inherited from class com.castlabs.android.Plugin
init, onRemotePlay
-
Field Details
-
SF_CODE_DCR
The SF code for DCR- See Also:
-
CONFIG_KEY_APPID
JSON Object configuration key for the app ID- See Also:
-
CONFIG_KEY_APPNAME
JSON Object configuration key for the app name- See Also:
-
CONFIG_KEY_APPVERSION
JSON Object configuration key for the app version- See Also:
-
CONFIG_KEY_SFCODE
JSON Object configuration key for the app SF Code- See Also:
-
-
Constructor Details
-
NielsenPlugin
Create a new instance of the plugin with the given app id, app name and sf code that will be passed to the Nielsen SDK.- Parameters:
appId
- The App IDappName
- The App NameappVersion
- The App VersionsfCode
- The SF-Code
-
NielsenPlugin
Create a new instance of the plugin using the given JSON Object to configure the Nielsen SDK- Parameters:
configuration
- The configuration that will be passed to the Nielsen SDK
-
-
Method Details