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

Example Code for Multi-Level Categories - Now Available

For those of you who have been clamoring for a way to modify the Roku SDK videoplayer example to support additional category levels in the XML files, I have put together an example channel which does just that. I called it NewVideoPlayer because I couldn't think of a better name.

The code is available on GitHub: https://github.com/belltown/Roku-NewVideoPlayer. There's an example categories.xml and feed.xml file to get you started with a few random feeds. There's a Private Channel using the example feeds here: https://my.roku.com/account/add?channel=NEWVIDEOPLAYER

Rather than modify the Roku example channel, I started from scratch; it seemed easier that way. You should be able to just substitute your own XML files, which can be read from your package file or a remote url. There are a few other features I added (Play/Resume for the last 10 videos played, Play All, Play from Beginning, etc.) In addition to using the type of feed files used by the Roku SDK example, this code supports RSS feeds with MRSS and iTunes extensions. There's also code included to display feeds in an roGridScreen instead of an roPosterScreen.

Here's a list of supported features from the README file:


  • Unlimited <category> levels, each displayed using an roPosterScreen.
    The lowest <category> having <categoryLeaf> elements is displayed as an roPosterScreen with a filter banner.
    An roGridScreen can be used instead of the roPosterScreen with a filter banner, by changing 2 lines of code.
    All <category> and nested <category> elements must be specified in the top-level Xml file.
    Each <categoryLeaf> must refer to a separate <feed> file containing the feed's <item> elements.

  • The top-level Xml file may also be a Roku <feed> file, or an <rss> file.

  • RSS files may contain RSS 2.0 elements, MRSS extensions, and iTunes extensions.
    Note: The RSS/MRSS/iTunes extensions are ONLY supported in an <rss> feed, NOT in a Roku <feed>.

  • A "feed" attribute may be specified for a <category> element, only if there are no subordinate <categoryLeaf> elements.

  • A Roku feed (but not an RSS feed) may appear inline in the top-level Xml file,
    subordinate to a <categories> or <category> element, but not a <categoryLeaf>.

  • Xml files may be referenced either using a local Roku filename or a remote url (http or https).

  • Xml element and attribute names are case-insensitive.

  • See pkg:/xml/categories.xml and pkg:/xml/feed.xml for example feeds.

  • See RokuFeed.brs for a list of supported Xml elements for a Roku feed.

  • See Mrss.brs for a list of supported MRSS elements for an RSS feed.

  • See Itunes.brs for a list of supported iTunes elements for an RSS feed.

  • Supports Play/Resume, as well as 'Play all' and 'Play from beginning'.

  • The last play position for the previous 10 videos played is stored for 'Resume' functionality.

  • Should work on an SD TV, even if no SD streams are specified in the Xml feed file.

  • Supports both MP4 and HLS video streams.

  • Supports 'https' video and image urls.

  • Compatible with the Xml files used by the Roku SDK videoplayer example (TED Talks Videos).

  • Should work on all Roku firmware versions, including legacy 3.1 firmware.
6 REPLIES 6
accessfletch
Visitor

Re: Example Code for Multi-Level Categories - Now Available

belltown - First off, thanks for your contribution to the community!

In UITheme.brs, line 27 reads, "No logos in this implementation ..." ... and at first I thought it was just because the files you cite weren't in the images directory. So I put some logos in there, but they still don't display.

So I'm wondering if a) you really didn't support logos in this setup, and b) how I'd go about doing so if that's the case?
0 Kudos
accessfletch
Visitor

Re: Example Code for Multi-Level Categories - Now Available

Never mind; my noob mind just wrapped itself around "REM". 😄
0 Kudos
belltown
Roku Guru

Re: Example Code for Multi-Level Categories - Now Available

I was just about to tell you to remove the comments from those lines.
0 Kudos
hnet
Visitor

Re: Example Code for Multi-Level Categories - Now Available

This is an amazing line of code, I have used your template and rebuilt my beta channel Biztale. Now I want to use VAST as I tried to use the example it's not working to well in the manifest even though i copied the vast.xml to the XML folder and pasted as it shows below. This was being tested internally. my.roku.com/add/biztale

#*******************************************************************
#
# NewVideoPlayer -- Example Multi-Level Roku Channel
#
# Copyright (c) 2015, belltown. All rights reserved. See LICENSE.txt
#
#********************************************************************
#
title=Biztale 3.0
subtitle=NewVideoPlayer Example Roku Channel With Multi-Level Categories
#
major_version=1
minor_version=2
build_version=0
#
mm_icon_focus_hd=pkg:/images/mm_icon_focus_hd-366x210.png
mm_icon_focus_sd=pkg:/images/mm_icon_focus_sd-248x140.png
#
mm_icon_side_hd=pkg:/images/mm_icon_side_hd-108x69.png
mm_icon_side_sd=pkg:/images/mm_icon_side_sd-80x46.png
#
splash_screen_fhd=pkg:/images/mm_icon_focus_hd-366x210.png
splash_screen_hd=http://biztale.xyz/roku/images/splash_hd.png
splash_screen_sd=http://biztale.xyz/roku/images/splash_sd.png
#
splash_color=#414a4c
splash_min_time=1500
#
set up a pre-roll ad
vast = NWM_VAST()
vastURL = "pkg:/vast.xml"
util = NWM_Utilities()
raw = util.GetStringFromURL(vastURL)
? raw
vast.Parse(raw, false, true)
if vast.video <> invalid 'vast.ads.Count() > 0 and vast.ads[0].video <> invalid
PrintAA(vast.video)
video.preroll = vast.video
video.preroll.minBandwidth = 250
video.preroll.switchingStrategy = "full-adaptation"
end if
end sub
0 Kudos

Re: Example Code for Multi-Level Categories - Now Available

Do you have a new version with new sdk? :(, thanks in advance

Re: Example Code for Multi-Level Categories - Now Available

Yes, please do make an updated, optimized version. It would be so helpful for me and others. 

I've searched and searched on how to do this with the new system, tutorials don't seem to exist that I can find. 

0 Kudos