Forum Discussion

Beyond's avatar
Beyond
Reel Rookie
3 years ago

Pass URL as a parameter to Video node

Hello,

I am able to pass URL as a parameter to roVideoScreen following this blog post:
https://blog.roku.com/developer/2011/10/06/using-launch-parameters

Unfortunately roVideoScreen is deprecated and my channel will be rejected during certification if I use it.

Now I am trying to pass URL as a parameter to Video node using this example:
https://github.com/rokudev/samples/tree/master/media/VideoExample

I tried to use m.global to access Video node from Main function but it was unsuccessful.
Any help how to achieve this will be highly appreciated.

Thanks!

  • renojim's avatar
    renojim
    Community Streaming Expert

    You want to access the video node through the scene variable.  Following that example, it would be something like this:

    screen = CreateObject("roSGScreen")
    m.port = CreateObject("roMessagePort")
    screen.setMessagePort(m.port)
    scene = screen.CreateScene("VideoExample")
    screen.show()
    video_node = scene.FindNode("exampleVideo")
    videocontent = createObject("RoSGNode", "ContentNode")
    videocontent.title = "Example Video"
    videocontent.streamformat = "mp4"
    videocontent.url = "https://roku-webdev-opus.s3.amazonaws.com/public-videos/big+stream+trimmed.mp4"
    video_node.content = videocontent
    video_node.setFocus(true)
    video_node.control = "play"