STEP 4 :Register Mediamelon SDK using your assigned customerID.
Add the below lines in the onCreate method of PlayerActivity.java
Log.d("SmartStreamingIntgr",MMSmartStreamingExo2.getVersion());PropertyReader.setRegistrationURL("$Registration URL for the MMSDK");MMSmartStreamingExo2.enableLogTrace(true); //set to "false" before releasing player to productionif (MMSmartStreamingExo2.getRegistrationStatus() ==false){//Check if it is the first time Registration process is done// Please make the registration API call based on the version of the SDK you are using.MMSmartStreamingExo2.registerMMSmartStreaming("$PLAYERNAME","$CustomerID","$SUBSCRIBERID","$DOMAINNAME","$SUBSCRIBERTYPE","$SUBSCRIBERTAG");MMSmartStreamingExo2.reportPlayerInfo("$PlayerBrand","$PlayerModel","$PlayerVersion");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
Variable
Description
$PLAYERNAME
Player Name as in ExoPlayer, KalturaPlayer etc.
$CUSTOMERID
String containing your MediaMelon-assigned Customer ID.
$SUBSCRIBERID
String containing your subscriber’s ID. If you do not use subscriber IDs, leave it as it is.
$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, leave it as it is.
$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, leave it as it is.
$PLAYER_BRAND
String containing the player brand (e.g. “Exo”).
$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.
STEP 5 : Disable manifest fetching by the SDK.
If your workflow restricts the manifest to be accessible from both player and the MediaMelon Player SDK simultaneously, then, you can disable the fetch of manifest via :
MMSmartStreamingExo2.disableManifestsFetch(true);
Log.d("SmartStreamingIntgr", MMSmartStreamingExo2.getVersion());PropertyReader.setRegistrationURL("$Registration URL for the MMSDK"); MMSmartStreamingExo2.enableLogTrace(true); //set to "false" before releasing player to productionif(MMSmartStreamingExo2.getRegistrationStatus()==false){//Check if it is the first time Registration process is done// Please make the registration API call based on the version of the SDK you are using. MMSmartStreamingExo2.registerMMSmartStreaming("$PLAYERNAME", "$CustomerID", "$SUBSCRIBERID", "$DOMAINNAME", "$SUBSCRIBERTYPE", "$SUBSCRIBERTAG"); MMSmartStreamingExo2.reportPlayerInfo("$PlayerBrand", "$PlayerModel", "$PlayerVersion"); 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
Note: Disable Manifest Fetch is Optional
STEP 6: Create the Content Metadata object inside the initializePlayer() method of PlayerActivity.java .
String assetId ="assetID"; //enter you assetId hereString assetName ="assetNAME"; // enter your assetname here String videoId ="videoID"; // enter your videoId here ContentMetadata 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();
STEP 7: Get the mediaURL and vastURL from the Nowtilus SSAI stream url.
NOTE - The player needs to be given the extracted mediaURL as the playback URL.
String streamURL = "NOWTILUS SSAI URL";/*The streamURL gives the mediaURL and VastURL as a response as shown below ,extract the mediaURL and vastURL from the response*/{"mediaURL":"https://ssaipre.serverside.ai/hls/f18e5f62-230a-4cad-baf7-3d0e6d429aa7/master.m3u8?sid=75291960-6256-11ec-823d-5bdd72099bb9&api-key=31c8e40a-ee55-4a49-8af2-c76375b22b6e","vastURL":"https://ssaipre.serverside.ai/hls/f18e5f62-230a-4cad-baf7-3d0e6d429aa7/75291960-6256-11ec-823d-5bdd72099bb9/vast.xml"}
STEP 8: Add the below lines to the initializePlayer() method. Add the lines after the player is initialized and not null.
NOTE - boolean enablePollingforSSAI variable indicates whether the Mediamelon SDK needs to poll for the VAST URL or not. Please set it to true if you want to opt for polling else set it to false.
boolean clientSideTracking variable ingicates, whether Mediamelon SDK needs to fire tracking urls.
privatevoidinitializePlayer() {............MMSmartStreamingExo2.getInstance().initializeSession(player,MMQBRMode.QBRModeDisabled,"Extracted MediaURL from Nowtilus SSAI streamURL",null, assetId, assetName, videoId,null,contentMetadata );MMSmartStreamingExo2.getInstance().reportUserInitiatedPlayback();MMSmartStreamingExo2.getInstance().vastURLfromApplication="extracted vastURL from the NOwtilus SSAI URL";boolean enablePollingforSSAI =false; // set to true if you want to poll for vastMMSmartStreamingExo2.getInstance().initNewStream("Extracted MediaURL from Nowtilus SSAI streamURL",enablePollingforSSAI,clientSideTracking);
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 done// Please make the registration API call based on the version of the SDK you are using.MMSmartStreamingExo2.registerMMSmartStreaming("$PLAYERNAME","$MMCustomerID","$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 }
Inside the initializePlayer() method
String assetId ="assetID"; //enter you assetId here String assetName ="assetNAME"; // enter your assetname hereString videoId ="videoID"; // enter your videoId here ContentMetadata 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();//initializeSessionMMSmartStreamingExo2.getInstance().initializeSession(player,MMQBRMode.QBRModeDisabled,"Extracted MediaURL from Nowtilus SSAI streamURL",null, assetId, assetName, videoId,null,contentMetadata );MMSmartStreamingExo2.getInstance().reportUserInitiatedPlayback();MMSmartStreamingExo2.getInstance().vastURLfromApplication="extracted vastURL from the NOwtilus SSAI URL";boolean enablePollingforSSAI =false; // set to true if you want to poll for vastMMSmartStreamingExo2.getInstance().initNewStream("Extracted MediaURL from Nowtilus SSAI streamURL",enablePollingforSSAI);//get the SSAI Admanager and subscribe to eventsMMSmartStreamingNowtilusSSAIPlugin mmSmartStreamingNowtilusSSAIPlugin =MMSmartStreamingExo2.getInstance().getSSAIAdManager();MMSSAIEventsListeners mmssaiEventsListeners =newMMSSAIEventsListeners() { @OverridepublicvoidonAdImpression(mmAd ssaiAdInfo) { } @OverridepublicvoidonAdComplete(mmAd ssaiAdInfo) { } @OverridepublicvoidonCueTimelineEnter(mmAd ssaiAdInfo) { } @OverridepublicvoidonCueTimelineExit(mmAd ssaiAdInfo) { } @OverridepublicvoidonCueTimelineAdded(mmAdTimelineInfo timelineInfo) { }};mmSmartStreamingNowtilusSSAIPlugin.addListener(mmssaiEventsListeners);