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: 
joetesta
Roku Guru

How To remove category leafs from example videoplayer

This seems to be a common request for people starting out - the videoplayer example app includes multiple levels of categories and a lot of people want to start with only one level of categories. I just ran through it and this will get you started, how to modify the example videoplayer to remove the category leafs:

in the xml folder, change categories.xml to be like this, each "category" will now include a "feed":
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<categories>

<!-- banner_ad: optional element which displays an at the top level category screen -->
<banner_ad sd_img="http://rokudev.roku.com/rokudev/examples/videoplayer/images/missing.png" hd_img="http://rokudev.roku.com/rokudev/examples/videoplayer/images/missing.png"/>

<category title="Technology" description="TED Talks on Technology" sd_img="http://rokudev.roku.com/rokudev/examples/videoplayer/images/TED_Technology.png" hd_img="http://rokudev.roku.com/rokudev/examples/videoplayer/images/TED_Technology.png" feed="http://rokudev.roku.com/rokudev/examples/videoplayer/xml/themind.xml"/>

<category title="Entertainment" description="TED Talks on Entertainment" sd_img="http://rokudev.roku.com/rokudev/examples/videoplayer/images/TED_Entertainment.png" hd_img="http://rokudev.roku.com/rokudev/examples/videoplayer/images/TED_Entertainment.png" feed="http://rokudev.roku.com/rokudev/examples/videoplayer/xml/music.xml" />

<category title="Design" description="TED Talks on Design" sd_img="http://rokudev.roku.com/rokudev/examples/videoplayer/images/TED_Design.png" hd_img="http://rokudev.roku.com/rokudev/examples/videoplayer/images/TED_Design.png" feed="http://rokudev.roku.com/rokudev/examples/videoplayer/xml/creativity.xml"/>

</categories>


now put the categories.xml file on a web server your roku can access. (In my case I tested with a local web server on the LAN ip address 192.168.0.155)

update categoryFeed.brs as follows, use your own server address in place of 192.168.0.155
    'conn.UrlPrefix   = "http://rokudev.roku.com/rokudev/examples/videoplayer/xml"
conn.UrlPrefix = "http://192.168.0.155"


next make the following change / addition to categoryFeed.brs, change
        o.HDPosterURL = xml@hd_img

to this
        o.HDPosterURL = xml@hd_img
o.Feed = xml@feed


and also in CategoryFeed.brs change this
           kid.HDPosterURL = xml@hd_img
o.AddKid(kid)

to
            kid.HDPosterURL = xml@hd_img
kid.Feed = e@feed
o.AddKid(kid)


in appDetailSceen.brs Replace:
Function preShowDetailScreen(breadA=invalid, breadB=invalid) As Object
port=CreateObject("roMessagePort")
screen = CreateObject("roSpringboardScreen")
screen.SetDescriptionStyle("video")
screen.SetMessagePort(port)
if breadA<>invalid and breadB<>invalid then
screen.SetBreadcrumbText(breadA, breadB)
end if

with
Function preShowDetailScreen(breadA=invalid) As Object
port=CreateObject("roMessagePort")
screen = CreateObject("roSpringboardScreen")
screen.SetDescriptionStyle("video")
screen.SetMessagePort(port)


in appPosterScreen.brs change
    screen = preShowDetailScreen(category.Title, category.kids[m.curCategory].Title)
showIndex = showDetailScreen(screen, shows, showIndex)

to
    'screen = preShowDetailScreen(category.Title, category.kids[m.curCategory].Title)
screen = preShowDetailScreen(category.Title)
showIndex = showDetailScreen(screen, shows, showIndex)


and also in appPosterScreen.brs change this
    categoryList = CreateObject("roArray", 100, true)
for each subCategory in topCategory.Kids
categoryList.Push(subcategory.Title)
next
return categoryList

to this
    categoryList = CreateObject("roArray", 100, true)
categoryList.Push(topCategory)
return categoryList


and also in appPosterScreen.brs change this
    conn = InitShowFeedConnection(category.kids[item])

to this
    conn = InitShowFeedConnection(category)


that should do it - zip up images, source, manifest and Makefile and you should now have a videoplayer with only one level of categories.
aspiring
0 Kudos
4 REPLIES 4
bandal
Visitor

Re: How To remove category leafs from example videoplayer

How about multi-level categories and no leafs?
0 Kudos
joetesta
Roku Guru

Re: How To remove category leafs from example videoplayer

"bandal" wrote:
How about multi-level categories and no leafs?

I haven't tried but I don't think it'd be too difficult to make similar changes as I made above. Is it another common request?
aspiring
0 Kudos
RokuChris
Roku Employee
Roku Employee

Re: How To remove category leafs from example videoplayer

"joetesta" wrote:
"bandal" wrote:
How about multi-level categories and no leafs?

I haven't tried but I don't think it'd be too difficult to make similar changes as I made above. Is it another common request?


If memory serves, the MRSS sample allows for an arbitrary number of navigation levels.
0 Kudos
srbsdean
Visitor

Re: How To remove category leafs from example videoplayer

Is there a way to have some categories use category leafs and other categories not use leafs? I tried with the code you provided, using one category with leaf and one without and it did not work. Do you have any advice on how I could accomplish this?

Dean Anderson
0 Kudos