For the complete documentation index, see llms.txt. This page is also available as Markdown.

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

Release Notes

Step 1: Include MediaMelon SmartStreaming SDK

To integrate, unzip the MediaMelon Roku library and place the MMSmartStream folder in the components directory.

SDK: MediaMelon Roku IMA SDK

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.

CUSTOMER_ID is your MediaMelon assigned Customer ID. If you do not know your Customer ID, contact MediaMelon at customer-support@mediamelon.com.

3.3. Set Configuration Details:

  • hashSubscriberId: Set true to hash the subscriberId and to false to process the subscriberId without hashing.

  • enableCustomErrorReporting: If set to true SDK will consider only client-reported errors, else if set to false SDK will consider errors from the video node. (Refer Here)

3.4. Set Content Metadata:

3.5. Set Custom Configuration Details:

3.6. Set Codecs:

3.7. Set Custom Metadata:

For Custom Metadata, first, provide the mapping in the SmartSight dashboard under the settings section, and send the values to the SDK accordingly.

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:

It's important to set the view field start for every new view start, and to end when a view ends.

  • 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;

Upon setting enableCustomErrorReporting flag to true, SDK will stop listening to the video node errors. Only custom errors will be reported.

4.1. Video Error Reporting:

error_severity: Set this to "warning" for warnings and set to "fatal" for fatal errors.

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.

Guidelines & Constraints

  • Event Name

    • Maximum length: 35 characters

    • Allowed characters: Alphanumeric and underscore (_) only

    • Special characters are not supported

    • Recommended format: UPPERCASE with underscores (e.g., DRM_CHANGE)

  • Event Limits

    • A maximum of 35 custom events per session is allowed.

Custom events that violate these constraints (invalid event name or exceeding the per-session limit) will be dropped. Event values exceeding 1000 characters will be truncated to 1000 characters.

Release Notes

Current Release

v2.9.0 Mar 20, 2026

  • Added new fields: Encoding Service, App Session ID, and Preload

  • Added Seek Duration metric and improved Buffering calculation

  • Added Custom Event reporting

  • Added CDN Change event functionality

  • Added FPS and Audio/Video Codec data points in Rendition Change events

  • Enhanced Device and Network information reporting

  • Corrected Device Resolution and Player Resolution data

  • Improved network call handling to eliminate unnecessary waiting after HTTP calls

  • Improved Bitrate reporting

  • Added errorSeverity to mark an error, warning or fatal.

Last updated