The player application must register the SDK and provide player information once when the application launches. Please note that values provided in this integration step persist across video sessions. This is typically done when the player itself is initialized.
Perform registration tasks by modifying the onCreate() method in $EXOPROJECT/demos/main/src/main/java/com/google/android/exoplayer2/demo/PlayerActivity.java
The enableLogTrace() feature should be enabled for testing during the integration process. Set this to False before releasing the player to production
public void onCreate(Bundle savedInstanceState) {
...
}else {
trackSelectorParameters = new DefaultTrackSelector.ParametersBuilder().build();
clearStartPosition();
}
//<MMSmartStreaming 2b>
Log.d("SmartStreamingIntgr", MMSmartStreamingExo2.getVersion());
MMSmartStreamingExo2.enableLogTrace(true); //set to "false" before releasing player to production
if (MMSmartStreamingExo2.getRegistrationStatus() == false)
{ //Check if it is the first time Registration process is done
MMSmartStreamingExo2.setDeviceInfo($DEVICE_MARKETING_NAME);
MMSmartStreamingExo2.registerMMSmartStreaming($PLAYERNAME, $CUSTOMERID, $SUBSCRIBERID, $DOMAINNAME, $SUBSCRIBERTYPE, $SUBSCRIBERTAG);
MMSmartStreamingExo2.reportPlayerInfo("CustomPlayerName", ExoPlayerLibraryInfo.VERSION, "1.0");
MMSmartStreamingExo2.getInstance().setContext(getApplicationContext()); //Please make sure to provide the application's context here, and not the activity's context
MMSmartStreamingExo2.getInstance().reportAppInfo($APP_NAME,$APP_VERSION);
MMSmartStreamingExo2.getInstance().reportVideoQuality($VIDEO_QUALITY);
}
MMSmartStreamingExo2.disableManifestsFetch(true); // pass true if you want to disable Manifests Fetch
// </MMSmartStreaming 2b>
}
Variable
Description
$PLAYERNAME
String containing the player version (e.g. “Bitmovin_Android_Player_2.28.0”).
$CUSTOMERID
String containing your MediaMelon-assigned Customer ID.
$SUBSCRIBERID
String containing your subscriber’s ID. If you do not use subscriber IDs, enter null
$DOMAINNAME
String containing your section of your subscriber or assets. (Optional)
$SUBSCRIBERTYPE
String containing the subscriber type (e.g. “Free”, “Paid”). If you do not use subscriber types, enter null
$SUBSCRIBERTAG
String containing an additional subscriber-specific information. This is sent in clear (not hashed) to SmartSight and it is advised to not send sensitive information in this field.
$ASSETID
String containing Asset Id.
$ASSETNAME
String containing Asset Name.
$VIDEOID
String containing your video’s ID. If you do not use videos IDs, enter null.
$PLAYER_BRAND
String containing the player brand (e.g. “bitmovin”).
$PLAYER_MODEL
String containing the player model. For example - This could be a variant of player. Say name of third party player used by organisation. Or any human readable name of the player.
$PLAYER_VERSION
String containing the player version.
$DEVICE_MARKETING_NAME
Device marketing name
$APP_NAME
Application Name
$APP_VERSION
Application Version
$VIDEO_QUALITY
"4K_HDR" or "4K_HLG". Use this if you need to pass a user defined video quality. Dont call this API otherwise
$SERIESTITLE
Name of the Series
$EPISODENUMBER
Episode Number
$GENRE
Genre
$DRMPROTECTION
Type of DRM Protection
$CONTENTTYPE
Type of Content : movie, trailer, episode etc
$SEASON
Season number
Step 3: Initialize Session & Report User Intent to Playback
The SDK must be initialized at the start of each video session. Initialization includes setting the application context, initializing the playback session, and indicating the intent for playback with the SDK.
protected boolean initializePlayer() {
if (player == null) {
Intent intent = getIntent();
...
...
...
// after player is initialised and not null anymore
String mediaUrl = "get the mediaURL from your application"
String assetId = "$ASSETID"; //enter you assetId here
String assetName = "$ASSETNAME"; // enter your assetname here
String videoId = "$VIDEOID"; // enter your videoId here
ContentMetadata cm = new ContentMetadata();
String episodeNumber = "$EPISODENUMBER";
String season = "$SEASON";
String genre = "$GENRE";
String drmProtection = "$DRMPROTECTION";
String contentType = "$CONTENTTYPE";
String title = "$SERIESTITLE";
cm.videoId=videoId;
cm.seriesTitle=title;
cm.season=season;
cm.genre=genre;
cm.episodeNumber=episodeNumber;
cm.drmProtection=drmProtection;
cm.contentType=contentType;
cm.assetName=assetName;
cm.assetId=assetId;
JSONObject contentMetadata = cm.getJSONObject();
//optional content metadata
//(optional) add custom tags
MMSmartStreamingExo2.getInstance().reportCustomMetadata("key","value");
MMSmartStreamingExo2.getInstance().initializeSession(player, MMQBRMode.QBRModeDisabled, mediaUrl, null, assetId, assetName, videoId,null,contentMetadata);
MMSmartStreamingExo2.getInstance().reportUserInitiatedPlayback();
...
...
}
Step 4: Report ended state when the player instance is released
In $EXOPROJECT/demos/main/src/main/java/com/google/android/exoplayer2/demo/PlayerActivity.java