Roku Scene Graph アプリケーションが Roku によって拒否されたため、ディープリンクについて理解する助けが必要です。
Roku はここでディープリンクについて説明しています: https://sdkdocs.roku.com/display/sdkdoc/Deep+Linkingですが、このドキュメントではディープリンクに関するすべての情報を詳しく説明しているわけではありません。たとえば、contentId と mediaType を取得するにはどうすればよいでしょうか?
main()
起動時に実行される関数は次のとおりです。
function main(args as Dynamic) as Void
print "args" args
if (args.ContentId <> invalid) and (args.MediaType <> invalid)
if (args.mediaType = "season")
HomeScreen()
end if
end if
end function
アプリケーションの起動後、args を出力し、この連想配列を取得します。ただし、これには contentId と mediaType は表示されません。
<Component: roAssociativeArray> =
{
instant_on_run_mode: "foreground"
lastExitOrTerminationReason: "EXIT_UNKNOWN"
source: "auto-run-dev"
splashTime: "1170"
}
この curl コマンドを使用すると、アプリケーションが正常に起動し、contentId と mediaType が表示されます。
curl -d "" "http://10.1.1.114:8060/launch/dev?contentID=e59066f501310da32b54ec0b64319be0&MediaType=season"
ディープリンクを簡単に理解し、実装するためのより良い例を提供してください。
あなたは正しい軌道に乗っています。ディープ リンクの目的は、ユーザーを Roku Search のリストまたはバナーからチャンネルのシーズンやエピソードに直接誘導することです。
シーン グラフ チャネル用にこれをプログラムする方法については、ドキュメントに優れた例がありません。したがって、これも自分で作成する必要がありました。実装したら、次の 2 つの方法でテストします。
Eclipse プラグイン -> ファイル > エクスポート > BrightScript デプロイメントを使用します。次のように DeepLinking params フィールドに入力します: contentID=1234&MediaType=episode
Roku Deep Link Tester を使用します: http://devtools.web.roku.com/DeepLinkingTester/
いくつかのディープリンク パラメータをチャネルにハードコーディングします。
main.brs にディープリンク ロジックを実装する方法は次のとおりです。
sub Main(args as Dynamic)
screen = createObject("roSGScreen")
m.port = createObject("roMessagePort")
screen.setMessagePort(m.port)
m.global = screen.getGlobalNode()
'Deep Linking
'args.ContentId = "78891" 'Testing only
'args.MediaType = "episode" 'Testing only
if (args.ContentId <> invalid) and (args.MediaType <> invalid)
m.global.addField("DeepContentId", "string", true)
m.global.addField("DeepMediaType", "string", true)
m.global.DeepContentId = args.ContentId
m.global.DeepMediaType = args.MediaType
end if
scene = screen.createScene("HomeScene")
screen.show()
'...load content, other startup logic
while true
msg = wait(0, m.port)
msgType = type(msg)
if msgType = "roSGScreenEvent"
if msg.isScreenClosed() then exit while
end if
end while
if screen <> invalid then
screen.close()
screen = invalid
end if
end sub
次に、コンテンツが初期化されたら、HomeScene.brs のホーム画面で:
'Check for deep link content
if m.global.DeepContentId <> invalid then
if (m.global.DeepMediaType = "short form" or m.global.DeepMediaType = "movie" or m.global.DeepMediaType = "episode") then
'find selected content in feed
'play episode or movie content directly
else if (m.global.DeepMediaType = "season")
'find selected content in feed
'show season screen for content
else
? "Unrecognized Deep Link Media Type"
end if
'It may be necessary to remove deep link params
m.global.DeepContentId = invalid
m.global.DeepMediaType = invalid
end if
これが Deep Linking を起動して実行するのに役立つことを願っています。何か見逃した場合はお知らせください。
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加