MediaMelon Roku SDK Integration with IMA
This document describes the Roku MediaMelon Player IMA SDK Integration with the Roku media player.
Step 1: Include MediaMelon SmartStreaming SDK
Step 2: Set up a new MediaMelon Task
Step 3: MediaMelon Code Integration
Step 4: Error Handling
Step 5: Google IMA Ads Integration
Step 6: Custom Events
Step 1: Include MediaMelon SmartStreaming SDK
To integrate, unzip the MediaMelon Roku library and place the MMSmartStream folder in the components directory.
Step 2: Set up a new MediaMelon Task
Create a new XML file MMTask.xml inside your components folder. This is used to link MediaMelon’s brsfiles into your application.
The MMTask.xmlfile should contain the following:
<component name="MMTask" extends="Task">
<interface>
<field id="video" type="node" alwaysNotify="true"/>
<field id="config" type="assocarray" alwaysNotify="true"/>
<field id="customConfig" type="assocarray" alwaysNotify="true" />
<field id="contentMetadata" type="assocarray" alwaysNotify="true"/>
<field id="customTags" type="assocarray" alwaysNotify="true"/>
<field id="error" type="assocarray" alwaysNotify="true"/>
<field id="adError" type="assocarray" alwaysNotify="true"/>
<field id="view" type="String" alwaysNotify="true"/>
<field id="exit" type="Boolean" alwaysNotify="true"/>
<field id="imaads" type="assocarray" alwaysNotify="true"/>
<field id="isAdImpressionSent" type="Boolean" alwaysNotify="true"/>
<field id="sdk_version" type="String" alwaysNotify="true"/>
<field id="seekThreshold" type="Integer" alwaysNotify="true"/>
<field id="codecs" type="assocarray" alwaysNotify="true" />
<field id="isVideoLive" type="Boolean" alwaysNotify="true" />
<field id="customEvent" type="assocarray" alwaysNotify="true" />
</interface>
<script type="text/brightscript" uri="pkg:/Components/MMSmartStream/MMSmartStreamWrapper.brs"/>
<script type="text/brightscript" uri="pkg:/Components/MMSmartStream/MMSmartStreamEngine.brs"/>
<script type="text/brightscript" uri="pkg:/Components/MMSmartStream/MMSmartStreamRokuPlugin.brs"/>
<script type="text/brightscript" uri="pkg:/Components/MMSmartStream/Utilities.brs"/>
</component>Step 3: MediaMelon Code Integration
3.1. Add MMTask Child Component:
Add the MediaMelon MMTask as a child component of the main video scene custom-playback-channel-master/components/MainScene.xml
3.2. Create MM Task Node:
In the main application, after the video instance has been created, create a MediaMelon Task node, and pass the Video node to it.
3.3. Set Configuration Details:
3.4. Set Content Metadata:
3.5. Set Custom Configuration Details:
3.6. Set Codecs:
3.7. Set Custom Metadata:
3.8. Set Seek Threshold:
By default seek threshold is set to 2 seconds in the SDK.
3.9. Set is Video Live:
Set isVideoLive to true for live video stream and to false for VOD stream
3.10. Set View:
Start View:
End View:
3.11. Run the SDK:
Step 4: Error Handling
By default, the SDK listens to the video node for errors. To report custom errors, set enableCustomErrorReporting flag to true and report the errors in the following way;
4.1. Video Error Reporting:
4.2. Ad Error Reporting:
Step 5: Google IMA Ads Integration
This guide demonstrates how to integrate the Mediamelon Roku SDK into a sample video player app with Google Ima Ads. Downloaded the basic example from GitHub.
5.1. Include MediaMelon Ad Plugin:
Include MMImaAdsPlugin.brs file into SDK.xml as shown below.
5.2. Create an IMA Stream Player:
Call MediaMelon APIs to notify adBreakStarted and adBreakEnded as shown below.
5.3. Add Event Listeners and Start the Stream:
After requesting your stream, add event listeners to track ad progress from the MediaMelon SDK by calling an API addMediaMelonAdCallbacks .
Step 6: Custom Events
The Custom Events API can be used to report events that are not covered by the default MediaMelon-supported events. Custom events must be reported within the SDK activity lifecycle. Events reported before SDK initialization or after session end will be ignored. Please refer to the guidelines and constraints below.
Release Notes
Last updated