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
publicvoidonCreate(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 productionif (MMSmartStreamingExo2.getRegistrationStatus() ==false){ //Check if it is the first time Registration process is doneMMSmartStreamingExo2.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.disableManifestsFetch(true); // pass true if you want to disable Manifests Fetch // </MMSmartStreaming 2b> }
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.
protectedbooleaninitializePlayer() {if (player ==null) {Intent intent =getIntent();.........// after player is initialised and not null anymoreString mediaUrl ="get the mediaURL from your application"String assetId ="assetID"; //enter you assetId hereString assetName ="assetNAME"; // enter your assetname hereString videoId ="videoID"; // enter your videoId hereContentMetadata cm =newContentMetadata();String episodeNumber ="EpisodeNumber";String season ="Season";String genre ="Genre";String drmProtection ="drmProtection";String contentType ="contentType";String title ="Title";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 tagsMMSmartStreamingExo2.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