Navigate directly to channel content by deep linking
On Roku devices, deep linking describes the process of launching channels and media content through an ad, a search result, or the My Feed feature. In order to support the global search interface and advertising initiatives, all Roku channels with indexed content are required to respond to deep link requests. The following guide details how to integrate deep linking on your Roku channel.The primary sections are:
- How deep linking works in Roku OS
- Modifying a channel to support deep linking
- Testing deep linking
Banner advertisements leverage deep links to open the specified content in the channel. To explore this opportunity, visit roku.com/advertising.
The first step is to modify the Main method to accept the deep linking parameters in BrightScript:Function Main (args as Dynamic) as Void
if (args.reason = “ad”) then
if (args.AdID <> invalid) then fireAdBeacon(args.AdID) else fireAdBeacon(“unspecified”) end if
end if
Args.reason
- is a required parameter and states why the channel was launched.Args.AdID
- is an optional parameter that is passed when the channel is launched from an ad. This parameter can be used to determine which ad launched the channel.fireAdBeacon()
- is a function for any tracking beacons that need to be fired.- Note: This is a function that the developer has to write. It is not a Roku SDK function.
Theif (user_validated() = true) then
do_validate_flow(screen)
end if
user_validated()
method determines if the user has signed up for the channel.
The following parameters are required to support ads or universal search:
Parameter | Description | Example |
contentID | Partner-defined unique identifier for a specific piece of content | contentID=12345, and so forth |
mediaType | Parameter to give context to the type of contentID passed | "series," "episode," "movie," "shortform," and "live"
The parameters "track" and "playlist" can also be used for music. Roku does not intend on supporting those in the OS, but you could extract them from an Ad. |
args.contentID
andargs.MediaType
Once finished, don’t forget to initialize the home screen:if (args.contentID <> invalid AND args.mediaType <> invalid) then
do_deeplink(args.contentID, args.mediaType, screen)
end if
do_Homescreen(screen)
Note: It is also possible to deep link from one channel to another via the roUrlTransfer component and the launch command. See the External Control Protocol (ECP) documentation for more details.
Developers need to consider the experience for Roku users when deep linking to different types of content such as episodes, movies, short form, etc.To pass channel certification, developers are required to implement episode selection screens (aka “episodic pickers”) when deep linking to a series.
Specifically, here are the main guidelines to follow:
- Series: When deep linking to a series, there must be a episode selection screen (“episode picker”) for easily selecting a specific episode in addition to the main item in focus.
- Episodes: When deep linking into a specific episode, it’s important to provide a springboard experience that includes an episode picker for different episodes. The behavior should keep the selected episode in focus with details while providing an ability to select other episodes within that view.
- Movies: There are two main ways a deep link should respond:
- When a movie has been purchased previously or is free: the content should play automatically.
- If a purchase is required to watch: a purchase screen or a “Buy Now” option on a springboard should be presented prior to playback.
- Short form: Content should play automatically.
- Live: Content should play automatically.
Theif (args.mediaType = “movie” )
doSpringBoard(ContentID, Screen)
else if (args.mediaType = “short form” or args.mediaType = “Live” or mediaType = “episode”) then
playMedia(ContentID, Screen)
else if (args.mediaType = “series”)
doEpisodicPicker(ContentID, Screen)
else
Print “Unknown media type “, args.mediaType
end if
user_validated()
method determines if the user is entitled to have access to the content.
PlayMedia()
takes a contentID and a screen and plays the media directly.
doEpisodicPicker()
is used when a user selects a series or season and a provider (specifically, your channel). The contentID of the episode and season will be passed to your channel. Use that information to display the correct episode picker. This can easily be done by using the contentID to store multiple parameters.
contentID
is a unique identifier for a specific piece of content. Since there is no predetermined format, you can have multiple parameters encoded in it (ex. “SeriesID | SeasonID | episodicID”). You can then parse the contentID for the following information:
Myargs=args.ContentID.split(“|”)
Series_ID = myargs[0]
Season_code = myargs[1]
For deep linking purposes, you only need the IP address of your Roku device and the ContentID of the content where you’d like to deep link. A ChannelID may be needed if the channel is not previously installed on the Roku player.
Be aware that deep linking is triggered by an http post to port 8060 with the channelID and contentID.
Sample command to launch a Roku channel:
curl -d ‘’
“http://<roku-ip-address>:8060/launch/<channel_id>?contentID=<contentID>&mediaType=series”
Note: When deep linking to a channel, you must test to see if the channel is installed or not, otherwise the command will not launch.
Check and prompt install if channel is not on the Roku Device:
curl -d ‘’
“http://<roku-ip-address>:8060/install/<channel_id>?contentID=<contentID>&mediaType=series”
Related Resources:
- RAF Framework: blog.roku.com/developer/2016/02/10/roku-ad-framework/
- Billing Services: blog.roku.com/developer/2016/04/07/roku-billing-services/
- External Control Protocol: sdkdocs.roku.com/display/sdkdoc/External+Control+Guide#ExternalControlGuide-ImplementingDeepLinkinginaChannel
- How search works: sdkdocs.roku.com/display/sdkdoc/Roku+Search