Deep linking is used for launching the public channel, universal search and directly open to a particular video in a public channel.
According to new Roku development guidelines, all public channels are now essential to implement deep linking to pass certification.
Implementation of Deep linking in Roku
Step 1: Modify the main method, by adding a parameter for accepting Deep linking.
Function Main (mainArgs as Dynamic) as Void End Function
Step 2: Now, check if the Roku channel is deep linked or not. If mainArgs.ContentID and mainArgs.MediaType both are not invalid then it is deep linked. If any of them are invalid then it is a normal channel.
Function Main (mainArgs as Dynamic) as Void If (mainArgs.ContentId <> invalid) and (mainArgs.MediaType <> invalid) print "Channel is deep linked" End If End Function
Step 3: Implement the next step as per the Media Type and ContentId for a particular channel. Roku has media types such as movie, episode, short-form, special, live and season.
Function Main (mainArgs as Dynamic) as Void If (mainArgs.ContentId <> invalid) and (mainArgs.MediaType <> invalid) If (mainArgs.mediaType = “movie” ) print "Play Movie ", mainArgs.ContentId Else If (mainArgs.mediaType = “live” ) print "Play Live ", mainArgs.ContentId Else If (mainArgs.mediaType = “episode” ) print "Play Episode ", mainArgs.ContentId Else If (mainArgs.mediaType = "short-form" or mainArgs.mediaType = "special" or mainArgs.mediaType = "season" ) print "Play ",mainArgs.mediaType, " ", mainArgs.ContentId Else 'Print an error message. Do not fail silently print "Unknown Media Type = ", mainArgs.mediaType End If End If End Function
Testing of Deep linking in Roku
Method 1: curl -d ” ” ‘http://ip-address:8060/launch/dev?contentID=123456&MediaType=live’
Method 2: Deep linking tester app
Hope you will now be able to deep link easily following the steps mentioned in this blog.
Do check out my blogs for more updates.