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.
If your workflow restricts the manifest to be accessible from both player and SDK simultaneously, then, you can disable manifest fetch. This is a optional step.
3.3: For Live streams contentNode.live has to be set to true
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 }
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.
There are three APIs that are exported from MediaMelon Roku IMA Ads Plugin from MMImaAdsPlugin.brs
Notify AdBreakStart
Notify AdBreakEnded
Add MediaMelon Callbacks
1. Include MMImaAdsPlugin.brs IMA plugin file into SDK.xml as shown below
<?xml version ="1.0" encoding ="utf-8"?><componentname="imasdk"extends="Task"><interface></interface><scripttype="text/brightscript"><![CDATA[ ' Your code goes here.]]></script>' MediaMelon IMA AdPlugin'<scripttype="text/brightscript"uri="pkg:/Components/MMSmartStream/MMImaAdsPlugin.brs"/></component>
2. Create an IMA stream player
Thisimplements three callback methods: loadUrl,adBreakStarted, and adBreakEnded.Call MediaMelon APIs to notify adBreakStarted and adBreakEnded as shown below
...sub setupVideoPlayer() sdk =m.sdkm.player =sdk.createPlayer()m.player.top =m.topm.player.loadUrl =Function(urlData)m.top.video.enableTrickPlay =falsem.top.urlData = urlData End Functionm.player.adBreakStarted =Function(adBreakInfo asObject) print "---- Ad Break Started ---- "m.top.adPlaying = Truem.top.video.enableTrickPlay =falsemmAdBreakStarted(adBreakInfo) ' MediaMelon API to notify AdBreakStart' End Functionm.player.adBreakEnded =Function(adBreakInfo asObject) print "---- Ad Break Ended ---- "m.top.adPlaying = Falsem.top.video.enableTrickPlay =truemmAdBreakEnded(adBreakInfo) ' MediaMelon API to notify AdBreakEnd' End FunctionEnd Sub
3. Add event listeners and start the stream
After requesting your stream, add event listeners to track ad progress from MediaMelon SDK by calling an APIaddMediaMelonAdCallbacks
Sub loadStream() sdk =m.sdksdk.initSdk()setupVideoPlayer() request =sdk.CreateStreamRequest()ifm.top.streamData.type ="live"request.assetKey =m.top.streamData.assetKeyelserequest.contentSourceId =m.top.streamData.contentSourceIdrequest.videoId =m.top.streamData.videoId end ifrequest.apiKey =m.top.streamData.apiKeyrequest.player =m.player requestResult =sdk.requestStream(request) If requestResult <> Invalid print "Error requesting stream ";requestResult Elsem.streamManager = Invalid While m.streamManager = Invalidsleep(50)m.streamManager =sdk.getStreamManager() End While If m.streamManager = Invalid or m.streamManager["type"] <> Invalid or m.streamManager["type"] ="error" errors =CreateObject("roArray",1, True) print "error ";m.streamManager["info"]errors.push(m.streamManager["info"])m.top.errors = errors Elsem.top.streamManagerReady = TrueaddCallbacks()addMediaMelonAdCallbacks(m.sdk,m.streamManager) ' MediaMelon Callback register'm.streamManager.start() End If End IfEnd Sub