Enquiry Form

Deep Linking in Roku

Deep Linkning in Roku

Deep Linking is widely used for the purpose of launching the public channel, performing the universal search and for directly opening to a specific part of the video that is in a public channel. The Roku app developer needs to implement the deep linking in order to access a piece of video content directly rather than accessing it only from the home page. The latest Roku app development guidelines have stated that all the public channels will be essentially important to completely implement the deep link to pass the certification.

Channel Behaviors, contentid and mediaType during deep linking

The Roku channel must have behaviors like handling invalid deep links, the unauthenticated users and displaying paywall when responding to the deep link request. In order to enable this deep linking, every piece of content present in the channel is identified by means of a unique string identifier, a contentid which can be defined with some valid ASCII string that is less than 255 characters in length.

The next process step will be to associate a proper Roku defined mediaType with each contented. The purpose of this mediaType is to convey to the Roku platform on handling the specific content. The content id must be an opaque string, a single string, URL encoded, as a command-line argument and be immutable. Once both the content id and media type are defined, they shouldn’t be changed until the Roku app is developed.

Implementation of Deep Linking in Roku Channel:

The Roku app developer must follow the below series of steps to perform the deep linking process in the Roku Channel resulting in advanced Roku app development

  • The Roku app developer has to firsts modify the Roku channel’s main.brs file in order to handle the deep linking. This can be done by either editing the Roku channel’s main() or the runuserinterface(). One more argument must be added to the function and can be named as args. The main() function must be modified so that the channel can accept the deep linking parameter easily.

This will be like, Function Main (args as Dynamic) as void.

The parameters of the function would be the contentid for defining a piece of content, the mediatype to identify the media type of the context and the third one is the correlator is the optional argument that is sent by ads during the launch of the channel

  • Adding the test code for args[contentid] and the args[MediaType]The code must be added in order to test the args[contentid] as well as the args[MediaType] are not the valid ones. In case these have values, then they are deep linked with So the testing condition will be like

Function Main (mainArgs as Dynamic) as Void

If (mainArgs.ContentId <> invalid) and (mainArgs.MediaType <> invalid)

print “Channel is deep linked”

End If

End Function

  • The next step for implementing the deep linking in the Roku channel is to add the code for launching the required scene whenever the contentid is valid. In case they are invalid, the Roku app developer has to ensure that the corresponding error message gets displayed.

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

End If

End If

End Function

  • This should be followed by the implementation of bookmarking for the series. The decision must be taken as to which episode has to be played. Once decided, go to the specific episode part and begin the playback option. Precise knowledge on finding a suitable place for playback in the episode should be known.
  • When the channel is running, it is necessary to use the roInputEvent for the purpose of catching deep links thereby preventing the delays in the channel launching. Direct playback commands can be deep linked to channel content by the Roku developer
  • The Roku developer must then test the process using the deep linking tester tool. One step is to try curl -d ” ” ‘http://ip-address:8060/launch/dev?contentID=123456&MediaType=live’ One can gain insights on testing the deep linking using  Roku deep linking tester tool.

Close Bitnami banner