Remember that there is no reason to supply DeepLink parameters to every video in your grid. I always supply ONE DeepLink to a very short video during the channel submission/update process, then if I think about it after Roku publishes the latest channel version, I change the supplied MediaID of the video in my feed.
In my main.brs I grab the DeepLink params passed into my channel (mediaID, etc.) then from heroScene.brs sometime just after the video grid is shown, I simulate a user Click to the DeepLinked MediaID. I handle any paid content just as if a user clicked on it, so there is no Deep Linking to Paid Content without going through the Please Subscribe process. Just before the DeepLinked video plays, set the DeepLink flag to false. I'm sure that Roku's examples don't consider the Subscription Content concerns with DeepLinking which is down right terrifying to me.
How you implement all of this depends on your BrightScript skills, but it's ultimately up to you as the channel owner. You do not have to use the online examples letter for letter. For security reasons, you have every right to be as creative and careful as you like.
sub Main(args as Dynamic) as Void
print "################"
print "Start of Channel"
print "################"
print "main.brs"
m.screen = CreateObject("roSGScreen")
m.port = CreateObject("roMessagePort")
m.screen.setMessagePort(m.port)
Setup(args)
MakeScene()
while(true)
msg = wait(0, m.port)
msgType = type(msg)
print msgType
print msg
if msgType = "roSGScreenEvent"
if msg.isScreenClosed() then return
' else if msgType = "roSGNodeEvent"
' if msg.GetField() = "RestartChannel"
' if msg.GetData() = "yes"
' print "restarting"
' m.scene.Close()
' MakeScene()
' Setup(args)
' end if
' end if
end if
end while
end sub
sub MakeScene()
m.scene = m.screen.CreateScene("heroScene")
m.scene.signalBeacon("AppDialogInitiate")
m.screen.show()
m.scene.signalBeacon("AppDialogComplete")
m.scene.signalBeacon("AppLaunchComplete")
end sub
sub Setup(args as Dynamic) as Void
m.global = m.screen.getGlobalNode()
m.global.id = "GlobalNode"
'DeepLinking
if args.contentID <> invalid AND args.mediaType <> invalid
m.global.addFields( {contentDLId: args.contentID} )
m.global.addFields( {mediaDPType: args.mediaType} )
m.global.addFields( {deepLinkingLand: true} )
else
m.global.addFields( {deepLinkingLand: false} )
end if
end sub