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: 
srbsdean
Visitor

Problem with Category Leaf and Special Category

I am using the videoplayer example and I have successfully created a channel up to the point where I had two categories with one leaf each, and I had another "special category" that was an About Us page with some paragraph text. As soon as I created a second category leaf, it gave me errors on the Debugger:
BrightScript Debugger> ------ Running ------
created feed connection for https://s3.amazonaws.com/select-broadcasting/roku/UE
A/XML/categories1.xml
url: https://s3.amazonaws.com/select-broadcasting/roku/UEA/XML/categories1.xml
Took: 27ms
testing-dean
Current Function:
105: Function initCategoryList() As Void
106:
107: conn = InitCategoryFeedConnection()
108:
109: m.Categories = conn.LoadCategoryFeed(conn)
110: m.Categories.Kids.Push({ Type: "About Us", ShortDescriptionLine1: "Abou
t Us", ShortDescriptionLine2: "Learn More about Theresa Garcia Ministry", HDPost
erUrl: "http://selectbroadcasting.org/roku/examples/source/SRBS/images/about-us-
HD.png", SDPosterUrl: "http://selectbroadcasting.org/roku/examples/source/SRBS/i
mages/about-us-SD.png" })
111: m.CategoryNames = conn.GetCategoryNames(m.Categories)
112:
113: End Function
'Dot' Operator attempted with invalid BrightScript Component or interface refere
nce. (runtime error &hec) in ...pkg:/source/appHomeScreen.brs(110)

110: m.Categories.Kids.Push({ Type: "About Us", ShortDescriptionLine1: "Abou
t Us", ShortDescriptionLine2: "Learn More about Theresa Garcia Ministry", HDPost
erUrl: "http://selectbroadcasting.org/roku/examples/source/SRBS/images/about-us-
HD.png", SDPosterUrl: "http://selectbroadcasting.org/roku/examples/source/SRBS/i
mages/about-us-SD.png" })
Backtrace:
Function initcategorylist() As
file/line: /tmp/plugin/JCAAAAOJB8...pkg:/source/appHomeScreen.brs(110)
Function showhomescreen(screen As ) As Integer
file/line: /tmp/plugin/JCAAAAOJB8...pkg:/source/appHomeScreen.brs(35)
Function main() As
file/line: /tmp/plugin/JCAAAAOJB8iu/pkg:/source/appMain.brs(20)

Local Variables:
global &h0020 rotINTERFACE:ifGlobal
m &h0010 bsc:roAssociativeArray, refcnt=4
conn &h0010 bsc:roAssociativeArray, refcnt=1
BrightScript Debugger>


My HomeScreen.brs is setup this way:
Function preShowHomeScreen(breadA=invalid, breadB=invalid) As Object

if validateParam(breadA, "roString", "preShowHomeScreen", true) = false return -1
if validateParam(breadA, "roString", "preShowHomeScreen", true) = false return -1

port=CreateObject("roMessagePort")
screen = CreateObject("roPosterScreen")
screen.SetMessagePort(port)
if breadA<>invalid and breadB<>invalid then
screen.SetBreadcrumbText(breadA, breadB)
end if

screen.SetListStyle("flat-category")
screen.setAdDisplayMode("scale-to-fit")
return screen

End Function


'******************************************************
'** Display the home screen and wait for events from
'** the screen. The screen will show retreiving while
'** we fetch and parse the feeds for the game posters
'******************************************************
Function showHomeScreen(screen) As Integer

if validateParam(screen, "roPosterScreen", "showHomeScreen") = false return -1

initCategoryList()
screen.SetContentList(m.Categories.Kids)
screen.SetFocusedListItem(0)
screen.Show()

while true
msg = wait(0, screen.GetMessagePort())
if type(msg) = "roPosterScreenEvent" then
print "showHomeScreen | msg = "; msg.GetMessage() " | index = "; msg.GetIndex()
if msg.isListFocused() then
print "list focused | index = "; msg.GetIndex(); " | category = "; m.curCategory
else if msg.isListItemSelected() then
print "list item selected | index = "; msg.GetIndex()
kid = m.Categories.Kids[msg.GetIndex()]
if kid.type = "About Us" then
ShowParagraphScreen()
else
displayCategoryPosterScreen(kid)
end if
else if msg.isScreenClosed() then
return -1
end if
end If
end while

return 0

End Function


'**********************************************************
'** When a poster on the home screen is selected, we call
'** this function passing an associative array with the
'** data for the selected show. This data should be
'** sufficient for the show detail (springboard) to display
'**********************************************************
Function displayCategoryPosterScreen(category As Object) As Dynamic

if validateParam(category, "roAssociativeArray", "displayCategoryPosterScreen") = false return -1
screen = preShowPosterScreen(category.Title, "")
showPosterScreen(screen, category)

return 0
End Function

'**********************************************************
'** Special categories can be used to have categories that
'** don't correspond to the content hierarchy, but are
'** managed from the server by data from the feed. In these
'** cases we might show a different type of screen other
'** than a poster screen of content. For example, a special
'** category could be search, music, options or similar.
'**********************************************************
Function displaySpecialCategoryScreen() As Dynamic

if validateParam(category, "roAssociativeArray", "displayCategoryPosterScreen") = false return -1
screen = preShowPosterScreen(category.Title, "")
showPosterScreen(screen, category)


return 0
End Function

'************************************************************
'** initialize the category tree. We fetch a category list
'** from the server, parse it into a hierarchy of nodes and
'** then use this to build the home screen and pass to child
'** screen in the heirarchy. Each node terminates at a list
'** of content for the sub-category describing individual videos
'************************************************************
Function initCategoryList() As Void

conn = InitCategoryFeedConnection()

m.Categories = conn.LoadCategoryFeed(conn)
m.Categories.Kids.Push({ Type: "About Us", ShortDescriptionLine1: "About Us", ShortDescriptionLine2: "Learn More about Theresa Garcia Ministry", HDPosterUrl: "http://selectbroadcasting.org/roku/examples/source/SRBS/images/about-us-HD.png", SDPosterUrl: "http://selectbroadcasting.org/roku/examples/source/SRBS/images/about-us-SD.png" })
m.CategoryNames = conn.GetCategoryNames(m.Categories)

End Function


Does anyone have any insight as to what might be happening here.

Thanks!
Dean
0 Kudos
2 REPLIES 2
joetesta
Roku Guru

Re: Problem with Category Leaf and Special Category

I guess you can't do this:

    m.Categories.Kids.Push({ Type: "About Us", ShortDescriptionLine1: "About Us", ShortDescriptionLine2: "Learn More about Theresa Garcia Ministry", HDPosterUrl: "http://selectbroadcasting.org/roku/examples/source/SRBS/images/about-us-HD.png", SDPosterUrl: "http://selectbroadcasting.org/roku/examples/source/SRBS/images/about-us-SD.png" })


You probably need to create an object first, assign the values, then push that object into m.Categories.Kids.

Or maybe it's just a matter of syntax and you *can* do that, but I'd look at how the other (non-special) Kids are generated and emulate that.
Update: I took a look at the example and it's pretty tricky with the recursive calls to 'ParseCategoryNode' . I think the easiest way would be by putting the special category into the xml and look at categoryFeed.brs starting at
elseif name = "specialCategory" then
(line 192 in the version i have), adjust to your needs.
aspiring
0 Kudos
srbsdean
Visitor

Re: Problem with Category Leaf and Special Category

I think it must have been something going wrong with where my xml document was being stored. I was storing it on an AWS S3 folder and it doesn't seem to play well there. I put the XML documents on my normal web server and the problem went away. Thanks for your time!
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.