live-streamingrokubrightscript

How to Implement Deep Linking in a Roku Live Streaming Channel?


I am developing a Roku channel dedicated to live streaming and I'm looking to implement deep linking. I've checked Roku's documentation but found limited details specific to live streams. The mediaType examples provided (such as tvSpecial, shortFormVideo, series, episode, movie, season) don’t specifically mention live streams.

Could anyone provide guidance or examples on how to:

Handle the contentID and mediaType parameters for live streaming scenarios.
Directly start a live stream based on these deep linking parameters.

Any insights, especially from those who have implemented similar functionality in Roku channels, would be greatly appreciated.

Thank you!


Solution

  • In Roku, you can handle deep linking for live streams by using custom media types. You can provide your app with a unique ID and a custom media type (for example, "live"), and then handle it accordingly within your app. Here's a simplified example:

    sub Main(args as dynamic)
        if args.contentID <> invalid and args.mediaType <> invalid
            ' Handle deep linking
            if args.mediaType = "live"
                ' Start live stream
                startLiveStream(args.contentID)
            else
                ' Handle other media types
                handleOtherMediaType(args.mediaType, args.contentID)
            end if
        else
            ' Normal channel start
            showChannelHomeScreen()
        end if
    end sub
    
    sub startLiveStream(contentID as string)
        ' Here you would add the code to start the live stream based on the contentID
        ' This will depend on how your live streams are set up
    end sub
    
    sub handleOtherMediaType(mediaType as string, contentID as string)
        ' Here you would add the code to handle other media types
    end sub