Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
newchannel
Roku Guru

VideoExample: playing from json ??

Using the videoexample, what needs to be added to play from a json file on my own server? In the code I attached, it plays an mp4 and it plays hls but I need to access my own json file. Can someone lead me in the right direction so i can get started on this part? Would ir be a rourlxfer? 

Thank you.

<?xml version = "1.0" encoding = "utf-8" ?> 

<!--********** Copyright 2016 Roku Corp.  All Rights Reserved. **********-->

<component name = "VideoExample" extends = "Scene" >

  <script type = "text/brightscript" >

    <![CDATA[

    sub init()
      videocontent = createObject("RoSGNode", "ContentNode")

      videocontent.title = "Example Video"
      videocontent.streamformat = "mp4"
      videocontent.url = "http://xxxxxxx.mp4"

      video = m.top.findNode("exampleVideo")
      video.content = videocontent

      video.setFocus(true)
      video.control = "play"
    end sub

    ]]>

  </script>

  <children >

    <Video id = "exampleVideo"/>

  </children>

</component>

http://www.victoryNOWfilmsandtv.com
0 Kudos
3 REPLIES 3
newchannel
Roku Guru

Re: VideoExample: playing from json ??

I located this piece of code from the simple video player channel example. In what area in a channel code should this be added in order to url a rourltransfer to play files from a json on my server?

url = CreateObject("roUrlTransfer")
url.SetUrl("http://feed_path")
url.SetCertificatesFile("common:/certs/ca-bundle.crt")
url.AddHeader("X-Roku-Reserved-Dev-Id", "")
url.InitClientCertificates()
feed = url.GetToString()



http://www.victoryNOWfilmsandtv.com
0 Kudos
comperc
Visitor

Re: VideoExample: playing from json ??

the first piece of code is used when you have all information and ready to play the video. The second code is used when you want to download the list of video information (title, url, stream format, etc) such as when user start the channel, and that code should be put into a Task node
0 Kudos
newchannel
Roku Guru

Re: VideoExample: playing from json ??

Thank you for your help.
http://www.victoryNOWfilmsandtv.com
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.