Forum Discussion

tim_beynart's avatar
tim_beynart
Channel Surfer
8 years ago

Crash Course in SceneGraph available on GitHub

Hello everyone, at work I wrote a course to get new hires up to speed on Roku and SceneGraph, and I made it available on github. 
This represents the class I wish I had when I started on Roku.
Let me know if you find it helpful.
https://github.com/learnroku/crash-course

19 Replies

  • "tim_beynart" wrote:
    Here's a doc I put together for loading JSON in SG: https://gist.github.com/timbeynart-nbcuni/c73989ff347b101ef4176b8c104f82af#file-parse_json-brs-L15you will need to host the JSON file somewhere.

    The crash course also expects you to host the JSON on a local server, the lesson is here: https://github.com/learnroku/crash-course/blob/master/docs/Lesson3.md

    Hi Tim!
    The github example for loading JSON is *extremely* helpful. Thank you so much. Is the code intended to display an actual grid, or just retrieve the data? (I have no errors, the JSON loads but the screen is gray).
  • that's just to load the data... applying it to a gridscreen is up to you. It took me a while to get my head around how to structure the roContentNodes properly for the different lists, they each require a specific hierarchy of nodes to work right.
    EDIT I take that back, that example is supposed to work with a RowList. make sure `mediaitem.xml` is in your `components` directory. I don't have time to debug it right now...
  • "tim_beynart" wrote:
    that's just to load the data... applying it to a gridscreen is up to you. It took me a while to get my head around how to structure the roContentNodes properly for the different lists, they each require a specific hierarchy of nodes to work right.
    EDIT I take that back, that example is supposed to work with a RowList. make sure `mediaitem.xml` is in your `components` directory. I don't have time to debug it right now...

    I copied over your examples to my own project and I actually did not see any RowList appear, just a blank screen, but no errors either (which I guess is good lol). I'm using your crash course/JSON feed example with the Roku Sample Tutorial so hopefully I'll get it working soon. The SceneGraph stuff is a whole other level for me... thanks for the help 🙂
  • "tim_beynart" wrote:
    try this and see if it fixes it...
    on this line https://gist.github.com/timbeynart-nbcuni/c73989ff347b101ef4176b8c104f82af#file-parse_json-brs-L9
    change "GridScreen" to "RowList" to match the id in the XML file.

    I've actually always gotten an error on that line, and had it commented out - 
    Current Function:
    001:  sub loadContent()
    002:    shortFormRow = GetShortForm()
    003:    list = [
    004:        {
    005:            TITLE : "Short Form"
    006:            ContentList : shortFormRow
    007:        }
    008:    ]
    009:*   m.contentselection = m.top.findNode("RowList")
    010:    m.contentselection.content = ParseContent(list)
    011:  end sub
    Interface not a member of BrightScript Component (runtime error &hf3) in pkg:/source/parse_json.brs(9)
    009:   m.contentselection = m.top.findNode("RowList")

     
    I've got my code set up just like yours, but I see this when I try running it. Not sure why. I had it commented out last week but still haven't fully debugged.
  • i have to admit i just copied these files from a more complete project... never fully debugged 'em
  • "tim_beynart" wrote:
    i have to admit i just copied these files from a more complete project... never fully debugged 'em

    I just successfully used your JSON with the Simple Grid with Details and Video example. So that's one step closer, at least! thank you!!! 
  • 360tv's avatar
    360tv
    Streaming Star
    Hey, I just wanted to say thanks for this crash course. I've been putting off getting caught up on this new Scene Graph thing since I've been away from Roku development for a long while. I couldn't wrap my brain around the concepts until I followed this. There's a few mistakes, I can't remember what they were, but I was able to figure it out and get it done. I learned a ton in the few hours it took me to do this. Thanks again!

    P.S. Be aware, I skipped lesson 6 on account of the readme.md links Lesson 6 and Lesson 7 both to Lesson 7, skipping 6, explaining why my video player didn't get set up. 

    P.P.S. If anyone can point me in the right direction for figuring out an Error Code -4: "No Streams were provided for playback" error for a hls stream that I know works everywhere else, including my old Roku channel? I plugged in the url for the stream in the first entry of the drama.json;

        "items": [
            {
                "id": "D123",
                "title": "360 Music Television",
                "description": "Live Video Feed",
                "thumbnail": "http://xxx.xxx.xxx.xxx/roku_lessons/images/thumbnail-drama1.jpg",
                "url":"http://xxx.xxx.xxx.xxx/live/360/index.m3u8",
                "streamformat":"hls"
            }
    ]
  • Thank you for all of your work and time to provide the tutorial. I have several channels to migrate over to scenegraph and your tutorial will be very helpful.