Search code examples
rokubrightscript

Roku Smart TV - LabelList not showing


I am submitting a Roku channel, and it is continually rejected because the "Play" button doesn't show up on the Springboard.

I used one of the templates for the base code. It puts the "Play" button on screen using a LabelList. It works perfectly fine on the device I test on, which is a Roku stick. They seem to be testing these on a Roku Smart TV though, and something about that device is preventing the LabelList from showing.

Below is the code the adds the content to the LabelList.

Sub OnContentChange()
    content = m.top.content
    m.description.content = content
    m.description.Description.width = "770"
    m.poster.uri = content.hdBackgroundImageUrl
    m.background.uri = content.hdBackgroundImageUrl

    ' create buttons
    m.buttonArray = []

    moviePlaysSection = CreateObject("roRegistrySection", "MoviePlays")
    if moviePlaysSection.Exists(content.guid)
        m.currentPosition = StrToI(moviePlaysSection.Read(content.guid))
    end if

    if content.url <> ""
        m.buttonArray.push({ title : "Play" })
    end if

    if content.trailerUrl <> invalid
        m.buttonArray.push({ title : "Play Trailer" })    
    end if

    m.buttons.content = ContentList2SimpleNode(m.buttonArray)
End Sub

Function ContentList2SimpleNode(contentList as Object, nodeType = "ContentNode" as String) as Object
    result = createObject("roSGNode",nodeType)
    if result <> invalid
        for each itemAA in contentList
            item = createObject("roSGNode", nodeType)
            item.setFields(itemAA)
            result.appendChild(item)
        end for
    end if
    return result
End Function

Is there something weird about the Roku TV that prevents LabelLists from displaying or am I doing something wrong?


Solution

  • The problem ended up being that I was trying to access the Roku registry in the main thread. This is not allowed in Roku versions less than 8. You have to access it inside a Task instead. The code was working fine on my hardware which was running version 8. The hardware Roku was testing it on was running version 7. Simple fix but hard to track down without the correct hardware.