This document describes the Roku MediaMelon Player SDK Integration with the Roku media player.
This document describes the Roku MediaMelon Player SDK Integration with the Roku media player.
Step 1: Add the MediaMelon Player SDK
Unzip the MediaMelon Player SDK and place its contents in the MMSmartStream Folder in the components directory of the sample application code downloaded from the link above.
Step 2: Setup a new MediaMelon Player SDK Task
Create a new Task XML named MMTask.xml inside your components folder and give it the following interface. This is used to link the SmartSight Player SDK's Brightscript files into your application.
The MMTask.xml file should contain the following code:
Note: There is an upper limit of 3 custom tags that can be sent to SmartSight. If you need to send more tags, please contact your MediaMelon sales representative.
For Live streams ‘contentNode.live’ has to be set to true as shown below:
contentNode.live=true
Step 4: Error handling
In most cases the Error handling in Roku applications is done by an Error Handler at the application level. For passing on the errors to the Media Melon SDK the following code snippet needs to be added to the error handling function.
'Send the error message to the MM SDK
m.MM.error = { errorMsg : m.video.errorMsg }
Step 5: CSAI Ad Tracking using Roku Ad FrameWork
RAF = Roku_Ads()
RAF.setAdUrl(vastTag)
logObj = {
log: function(evtType = invalid as dynamic, ctx = invalid as dynamic)
'The below function sends the Ad data to MediaMelon SDK for ad tracking
sendAdDataToMMSDK(ctx)
}
logFunc = function(obj = invalid as dynamic, evtType = invalid as dynamic, ctx = invalid as dynamic)
obj.log(evtType, ctx)
end function
RAF.setTrackingCallback(logFunc, logObj)
adPods = RAF.getAds()
function sendAdDataToMMSDK(ctx as object)
if m.global <> invalid and m.global.MMAnalytics <> invalid
m.global.MMAnalytics.setField("mmAdData", ctx)
end if
end function
Set the field named mmAdPlaying to true when an ad break started as shown below:
'preroll ads
if adPods <> invalid and adPods.count() > 0
video.control = "stop"
m.top.playingAd = true
print "Preroll adPods > " adPods
m.global.MMAnalytics.setField("mmAdPlaying", true) 'This line is part of MM SDK Integration
keepPlaying = RAF.showAds(adPods, invalid, view)
end if
'midroll ads
if adPods <> invalid and adPods.count() > 0
'ask the video to stop - the rest is handled in the state=stopped event below
print "Midroll adPods > " adPods
m.global.MMAnalytics.setField("mmAdPlaying", true) 'This line is part of MM SDK Integration
video.control = "stop"
end if
String containing your MediaMelon-assigned Customer ID.
SUBSCRIBER_ID
String containing your Subscriber’s ID. If you do not use subscriber IDs, enter null
DOMAIN_NAME
String containing your section of your subscriber or assets. (Optional)
APP_NAME
String containing App Name.
APP_VERSION
String containing App Version
SUBSCRIBER_TYPE
String containing the Subscriber Type (e.g. “Free”, “Paid”). If you do not use subscriber types, enter null
SUBSCRIBER_TAG
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.
ASSET_ID
String containing Asset Id.
ASSET_NAME
String containing Asset Name.
VIDEO_ID
String containing your video’s ID. If you do not use videos IDs, enter null.
CONTENT_TYPE
String containing type of the Content. For example - "Movie", "Special", "Clip", "Scene Epis Lifts".
GENRE
String containing Genre of the content. For example - "Comedy", "Horror".
DRM_PROTECTION
Widevine, Fairplay, Playready etc. Unknown means content is protected, but protection type is unknown. For clear contents, do not set this field
EPISODE_NUMBER
String containing sequence number of the Episode.
SEASON
String containing the Season. For example - "Season1".
SERIES_TITLE
String containing Title of the Series.
VIDEO_TYPE
String containing Video Type. For example - "LIVE", "VOD".
CUSTOM_TAGS
Extra custom metadata can be added here if required. If extra metadata is not required, enter null.