Step 2: Integrate MediaMelon Player SDK Code to Basic Playback App
The player application must register the MediaMelon Player 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.
Please provide the exact correct details in all fields like CUSTOMER_ID, ASSET_ID, ASSET_TITLE, VIDEO_ID, PLAYER_BRAND, PLAYER_MODEL, PLAYER_VERSION, PLAYER_NAME, DOMAIN_NAME, SUBSCRIBER_ID, SUBSCRIBER_TYPE & SUBSCRIBER_TAG.
Please provide the doHash value in setSubscriberInformation(), doHash boolean variable indicates whether the SUBSCRIBER_ID to be hashed or not.
This data helps in debugging through MediaMelon SmartSight if anything goes wrong.
Added the isLive API in sample application, if isLive value needs to set externally then use the following API, else if it needs to set by the player then don’t call the API.
MMSmartStreamingBitmovinAdaptor.setIsLive(true);//for live streams pass true,else false
protectedvoidinitializePlayer() {//Player creation player =Player.create(this);playerView.setPlayer(player);// MediaMelon codeString assetId ="assetID"; //enter you assetId hereString assetName ="assetNAME"; // enter your assetname hereString videoId ="videoID"; // enter your videoId hereMMAVAssetInformation assetInformation =newMMAVAssetInformation(assetId, assetName, videoId);String jsonAssetInfo =assetInformation.toJSON();MMSmartStreamingBitmovinAdaptor mmSmartStreamingBitmovinAdaptor =newMMSmartStreamingBitmovinAdaptor(getApplicationContext()) ;MMSmartStreamingBitmovinAdaptor.JsonFromClient=jsonAssetInfo;MMSmartStreamingBitmovinAdaptor.enableLogTrace(false); //set this to false before releasing to productionMMSmartStreamingBitmovinAdaptor.getVersion();//set the isLive valueMMSmartStreamingBitmovinAdaptor.setIsLive(true);//For Live streams true, else false//register customerMMRegistrationInformation registrationInformation =newMMRegistrationInformation("CustomerID","PlayerName");//register the playerregistrationInformation.setPlayerInformation("PlayerBrand","PlayerModel","PlayerVersion");registrationInformation.setDomain("DOMAINNAME");registrationInformation.setSubscriberInformation("SUBSCRIBERID","SUBSCRIBERTYPE","SUBSCRIBERTAG","doHash");MMSmartStreamingBitmovinAdaptor.setPlayerRegistrationInformation(registrationInformation, player,this);String url ="Provide Session Resolver URL here";String[] arr =url.split("api-key=");String nowtilusApikey = arr[1];mmSmartStreamingBitmovinAdaptor.setContentProviderDetails(url);mmSmartStreamingBitmovinAdaptor.setURL(url); MMSmartStreamingBitmovinAdaptor.apikey= nowtilusApikey;//change the below sourceType according to the stream format for eg : SourceType.DashSourceConfig sourceConfiguration =newSourceConfig(url,SourceType.Hls);Source playerSource =Source.create(sourceConfiguration);MMSmartStreaming.getInstance().reportUserInitiatedPlayback();//load the source into the playerthis.player.load(playerSource); }
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.
Step 3 : (Optional) Report Content Metadata
Optionally, the user of the MediaMelon Player SDK may choose to set additional content metadata metrics as below:
To enable Content Metadata , user need to include the following package in BasicPlayback app.
import com.mediamelon.qubit.ep.ContentMetada;
//optional content metadataContentMetadata 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 j =cm.getJSONObject();MMSmartStreamingBitmovinAdaptor.contentMetadataFromUser=j;//optional content metadata
Step 4: (Optional) Disable Manifest Fetch
If your workflow restricts the manifest to be accessible from both player and SDK simultaneously, then, you can disable the fetch of manifest via API disableManifestsFetch:
If Asset Information needs to be updated dynamically during the live session without re-initiating the player, then the "updateAssetInfo” API can be used to update the new AssetInfo.
Note:
This API must be called for updating asset info for the live streams only
This API must be called after the Player has started the playback of the live stream.
New Asset Info Object will override the previous values, Hence set all the fields that are required every time calling this API.
// make a new MMAVAssetInformation objectMMAVAssetInformation newAssetInformation =newMMAVAssetInformation("$assetId","$assetName","$videoId");// add the new updated content metadata (episodeNumber, genre, seriesTitle...) MMSmartStreamingBitmovinAdaptor.updateAssetInfo(newAssetInformation,player,"$season","$genre","$episodeNumber","$contentType","$videoType","$drmProtection","$seriesTitle");
Step 8: To Add Listener , get the Ad events from SSAIAdManager
//exposing the ad listeners to the player applicationMMSSAIEventsListeners mmssaiEventsListeners =newMMSSAIEventsListeners() {@OverridepublicvoidonAdImpression(mmAd ssaiAdInfo) {}@OverridepublicvoidonAdComplete(mmAd ssaiAdInfo) {}@OverridepublicvoidonCueTimelineEnter(mmAd ssaiAdInfo) {}@OverridepublicvoidonCueTimelineExit(mmAd ssaiAdInfo) {}@OverridepublicvoidonCueTimelineAdded(mmAdTimelineInfo timelineInfo) {}};MMSmartStreamingNowtilusSSAIPlugin obj =mmSmartStreamingBitmovinAdaptor.getSSAIAdManager();obj.addListener(mmssaiEventsListeners);