We have developed a Roku channel using Roku VideoPlayer Sample Channel (https://github.com/rokudev/videoplayer-channel). Although a recent submittal to Roku was rejected for not providing a deep linking capability. The main.brs
provides means to parse a request for a deep link which I've been able to implement to obtain my contentID
and mediaType
based on a curl command as follows:
curl -d '' 'http://192.168.1.24:8060/launch/dev?MediaType=special&contentID=49479'
The main.brs
comments say to
launch/prep the content mapped to the contentID here.
We're using the xml files to provide the Roku "categories" screen and the screen for the listing after selecting an item from the categories screen (including the springboard screen). Within these xml files, we tag the contentID
and mediaType
of every video item.
I'm fairly new to the Roku development. While we've been able to create channels previously using their video channel template, I don't know how to "launch/prep the content mapped to the contentID". I've searched and tried various other calls (ie - playMedia(ContentID, Screen)
), but I get errors on the debugger relating to "function call operator () attempted on non-function".
I would appreciate some instruction on how to jump to the springboard of the video based on the value of the contentID
passed using the deep linking command. Or a means to play the video based on the contentID
in the xml file.
Here's my main.brs:
sub Main(input as Dynamic)
print "################"
print "Start of Channel"
print "################"
' Add deep linking support here. Input is an associative array containing
' parameters that the client defines. Examples include "options, contentID, etc."
' See guide here: https://sdkdocs.roku.com/display/sdkdoc/External+Control+Guide
' For example, if a user clicks on an ad for a movie that your app provides,
' you will have mapped that movie to a contentID and you can parse that ID
' out from the input parameter here.
' Call the service provider API to look up
' the content details, or right data from feed for id
if input <> invalid
print "Received Input -- write code here to check it!"
if input.reason <> invalid
if input.reason = "ad" then
print "Channel launched from ad click"
'do ad stuff here
end if
end if
if input.contentID <> invalid
m.contentID = input.contentID
print "contentID is: " + input.contentID
print "mediaType is: " + input.mediaType
'launch/prep the content mapped to the contentID here
end if
end if
showHeroScreen(input)
end sub
' Initializes the scene and shows the main homepage.
' Handles closing of the channel.
sub showHeroScreen(input as object)
print "main.brs - [showHeroScreen]"
screen = CreateObject("roSGScreen")
m.port = CreateObject("roMessagePort")
screen.setMessagePort(m.port)
scene = screen.CreateScene("VideoScene")
m.global = screen.getGlobalNode()
'Deep link params
m.global.addFields({ input: input })
screen.show()
while(true)
msg = wait(0, m.port)
msgType = type(msg)
if msgType = "roSGScreenEvent"
if msg.isScreenClosed() then return
end if
end while
end sub
I'm thinking if I can get the params for deep linking properly set prior to the screen.show call, it should work? I am able to output the outputID and mediaType values using the debugger when using the curl to call the deep link, but it just goes to the home screen without cueing up the video that was deep linked.
Any help is appreciated.