【发布时间】:2018-06-24 02:07:14
【问题描述】:
我们使用 Roku VideoPlayer Sample Channel (https://github.com/rokudev/videoplayer-channel) 开发了一个 Roku 频道。尽管最近向 Roku 提交的文件因未提供深度链接功能而被拒绝。 main.brs 提供了解析深层链接请求的方法,我已经能够实现该深层链接以基于 curl 命令获取我的 contentID 和 mediaType,如下所示:
curl -d '' 'http://192.168.1.24:8060/launch/dev?MediaType=special&contentID=49479'
main.brs cmets 说
在此处启动/准备映射到 contentID 的内容。
我们正在使用 xml 文件来提供 Roku“类别”屏幕和从类别屏幕(包括跳板屏幕)选择项目后的列表屏幕。在这些 xml 文件中,我们标记了每个视频项目的 contentID 和 mediaType。
我对 Roku 开发还很陌生。虽然我们之前已经能够使用他们的视频频道模板创建频道,但我不知道如何“启动/准备映射到 contentID 的内容”。我已经搜索并尝试了各种其他调用(即 - playMedia(ContentID, Screen)),但在调试器上出现与“函数调用运算符 () 尝试在非函数上”相关的错误。
我将不胜感激有关如何根据使用深度链接命令传递的contentID 的值跳转到视频跳板的说明。或者一种基于 xml 文件中的contentID 播放视频的方法。
这是我的 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
我在想是否可以在 screen.show 调用之前正确设置深度链接的参数,它应该可以工作吗?使用 curl 调用深层链接时,我可以使用调试器输出 outputID 和 mediaType 值,但它只是进入主屏幕,而不提示深层链接的视频。
感谢任何帮助。
【问题讨论】:
-
借助一些额外的外部帮助,我能够建立深层链接。深度链接是通过 UriHandler.brs 处理的,方法是检查结果值,然后调用 UriHandlers.brs 中的单独函数来执行深度链接。
标签: deep-linking roku