The player application must register the SDK and provide player information once the player is initialized. Please note that values provided in this integration step persist across video sessions.
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.
The enableLogTrace() feature should be enabled for testing during the integration process. Set this to False before releasing the player to production.
CUSTOMER_ID is your MediaMelon assigned Customer ID. If you do not know your Customer ID contact MediaMelon at customer-support@mediamelon.com.
Step 5: Report Experiment Name
Step 6: Report Sub-Property Id
Step 7: Report View Session Id
Step 8: Report Player Resolution
Step 9: Report Custom Errors
Make sure that enableCustomErrorReporting is set to true for this to be able to report errors
Step 10: Report Ended State
Report ENDED state in PlayerActivity when playback ends.
If not reported at the end of the playback, it may reflect a longer playtime.
Step 11: Enable IMA/DAI Ad tracking
Add the following steps to enable IMA/DAI Ad tracking
11.a: IMA Ad Tracking
Alternate method for IMA ad tracking
11.b: DAI Ad Tracking
The function onAdsManagerLoaded is part of AdsLoader.AdsLoadedListener
protected boolean initializePlayer() {
// after the player is initialized and the player instance is not null
initializeMediaMelon();
...
}
void initializeMediaMelon(){
MMSmartStreamingExo2.enableLogTrace(false);
if (MMSmartStreamingExo2.getRegistrationStatus() == false)
{
MMSmartStreamingExo2.getInstance().setContext(getApplicationContext()); //Please make sure to provide the application's context here, and not the activity's context
boolean hashSubscriberId = true;
MMSmartStreamingExo2.registerMMSmartStreaming("PLAYER_NAME", "CUSTOMER_ID", "SUBSCRIBER_ID", "DOMAIN_NAME", "SUBSCRIBER_TYPE", "SUBSCRIBER_TAG", hashSubscriberId);
MMSmartStreamingExo2.reportPlayerInfo("PLAYER_BRAND", "PLAYER_MODEL", "PLAYER_VERSION");
MMSmartStreamingExo2.getInstance().reportBasePlayerInfo("BASE_PLAYER_NAME", "BASE_PLAYER_VERSION");
MMSmartStreamingExo2.reportAppInfo("APP_NAME","APP_VERSION");
MMSmartStreamingExo2.getInstance().setDeviceInfo("DEVICE_MARKETING_NAME");
//call this function to enable custom error reporting
MMSmartStreamingExo2.getInstance().enableCustomErrorReporting(true);
}
ContentMetadata cm = new ContentMetadata();
cm.assetName="ASSET_NAME";
cm.assetId="ASSET_ID";
cm.videoId="VIDEO_ID";
cm.seriesTitle="SERIES_TITLE";
cm.season="SEASON";
cm.genre="GENRE";
cm.episodeNumber="EPISODE_NUMBER";
cm.drmProtection="DRM_PROTECTION";
cm.contentType="CONTENT_TYPE";
JSONObject contentMetadata = cm.getJSONObject();
boolean isLive = false;
MMSmartStreamingExo2.getInstance().initializeSession(player, MMQBRMode.QBRModeDisabled, streamURL, contentMetadata, isLive);
MMSmartStreamingExo2.getInstance().reportUserInitiatedPlayback();
MMSmartStreamingExo2.getInstance().reportCustomMetadata("CUSTOM_KEY_1","VALUE1");
}
//Get the Analytics Bridge Object, this should be done wherever in your application the adsLoader is created
analyticsBridgeObject = MMSmartStreamingExo2.getInstance().getAnalyticsBridge();
//Initialising ads loader
ImaSdkSettings settings = sdkFactory.createImaSdkSettings();
adsLoader = sdkFactory.createAdsLoader(context, settings, displayContainer);
// For IMA Ad Tracking
public void requestAndPlayAds() {
adsLoader.addAdErrorListener(analyticsBridgeObject); // pass the Analytics Bridge object to the ads error listeners
adsLoader.addAdsLoadedListener(analyticsBridgeObject); // pass the Analytics Bridge object to the ads loaded listeners
}
adsLoader = new ImaAdsLoader.Builder(/* context= */ this)
.setAdEventListener(analyticsBridgeObject)
.setAdErrorListener(analyticsBridgeObject)
.build();
@Override
public void onAdsManagerLoaded(AdsManagerLoadedEvent event) {
//Get the Analytics Bridge Object ,this should be done wherever in your application the adsManager is loaded
analyticsBridgeObject = MMSmartStreamingExo2.getInstance().getAnalyticsBridge();
if(event.getStreamManager()!=null) {
streamManager = event.getStreamManager();
streamManager.addAdErrorListener(analyticsBridgeObject); // pass the Analytics Bridge object to the ad error listeners
streamManager.addAdEventListener(analyticsBridgeObject); // pass the Analytics Bridge object to the ad event listeners
streamManager.init();
}
}