在我的Roku频道中无法进行深层链接才能正常工作。
我已经在Roku SDK(尤其是其Deep Linking Doc)和各种论坛上进行了大量阅读。但是,我只是没有任何进展。
当前,我的频道使用带有详细信息的简单网格模板,该模板通过RSS文件提供视频内容。
这是我的main.brs文件的开头:
sub Main(args as Dynamic) as Void
showSGScreen(args)
if (args.mediaType <> invalid) and (args.contentID <> invalid)
if (args.mediaType = "movie" or args.mediaType = "episode" or args.mediaType = "short-form" or args.mediaType = "series" or args.mediaType = "special")
'play content directly
else
'deep linking issue such as a contentID not matching any content in the partner's catalog
'display an appropriate error message for the user
end if
else
'launch channel normally
end if
end sub
Sub RunUserInterface()
screen = CreateObject("roSGScreen")
scene = screen.CreateScene("HomeScene")
port = CreateObject("roMessagePort")
screen.SetMessagePort(port)
screen.Show()
oneRow = GetApiArray1()
twoRow = GetApiArray2()
threeRow = GetApiArray3()
fourRow = GetApiArray4()
list = [
{
TITLE : "Watch Our Services Live"
ContentList : oneRow
}
{
TITLE : "Without Ceasing: A Series On Prayer"
ContentList : twoRow
}
{
TITLE : "The Least Of These: Hope, Help, Heal"
ContentList : threeRow
}
{
TITLE : "The Bible: Learning To Live It"
ContentList : fourRow
}
]
scene.gridContent = ParseXMLContent(list)
while true
msg = wait(0, port)
print "------------------"
print "msg = "; msg
end while
if screen <> invalid then
screen.Close()
screen = invalid
end if
End Sub
Function ParseXMLContent(list As Object)
RowItems = createObject("RoSGNode","ContentNode")
for each rowAA in list
'for index = 0 to 1
row = createObject("RoSGNode","ContentNode")
row.Title = rowAA.Title
for each itemAA in rowAA.ContentList
item = createObject("RoSGNode","ContentNode")
' We don't use item.setFields(itemAA) as doesn't cast
streamFormat to proper value
for each key in itemAA
item[key] = itemAA[key]
end for
row.appendChild(item)
end for
RowItems.appendChild(row)
end for
return RowItems
End Function
Function GetApiArray1()
url = CreateObject("roUrlTransfer")
url.SetUrl("http://media.genepensiero.com/roku/rss/livestream.rss")
rsp = url.GetToString()
responseXML = ParseXML(rsp)
responseXML = responseXML.GetChildElements()
responseArray = responseXML.GetChildElements()
result = []
for each xmlItem in responseArray
if xmlItem.getName() = "item"
itemAA = xmlItem.GetChildElements()
if itemAA <> invalid
item = {}
for each xmlItem in itemAA
item[xmlItem.getName()] = xmlItem.getText()
if xmlItem.getName() = "media:content"
item.stream = {url : xmlItem.url}
item.url = xmlItem.getAttributes().url
item.streamFormat = "hls"
mediaContent = xmlItem.GetChildElements()
for each mediaContentItem in mediaContent
if mediaContentItem.getName() =
"media:thumbnail"
item.HDPosterUrl =
mediaContentItem.getattributes().url
item.hdBackgroundImageUrl =
mediaContentItem.getattributes().url
end if
end for
end if
end for
result.push(item)
end if
end if
end for
return result
End Function
然后我的RSS feed的示例是:
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
<channel>
<title>Bright Light Church</title>
<link />
<description>Live and Archived Bible Studies</description>
<language>en-us</language>
<pubDate>Wed, 26 Apr 2017 12:00:00 PT</pubDate>
<category>TV & Film</category>
<image>
<title>The Bible</title>
<url>http://media.genepensiero.com/roku/withoutceasing.jpg</url>
<width>-1</width>
<height>-1</height>
</image>
<item>
<title>Prayer Pressure</title>
<link>http://media.calvaryhanford.com/psalms/prayerpressure.mp4</link>
<description>David brings big requests to God and receives a big
revelation.</description>
<pubDate>Sun, 05 Mar 2017 10:15:00 PT</pubDate>
<guid isPermaLink="false">ch001</guid>
<media:content channels="2" type="special" isDefault="true" id="ch001" url="http://media.calvaryhanford.com/psalms/prayerpressure.mp4">
<media:description>David brings big requests to God and receives a big
revelation.</media:description>
<media:keywords>church, bible study, expository sermon</media:keywords>
<media:thumbnail url="http://media.genepensiero.com/roku/withoutceasing.jpg" />
<media:title>Prayer Pressure</media:title>
</media:content>
</item>
当我使用Deep Link Tester时,它只会打开进入主屏幕的频道,而不会启动特定视频。
任何见识将不胜感激。
答案 0 :(得分:0)
您似乎对contentID
和mediaType
并没有做任何事情,该应用程序不会自动(或神奇地)深度链接到内容。您必须将收到的contentId
与API中的某个项目进行匹配,然后从您的应用程序中导航或播放该项目(取决于mediaType
)。