Switching To Using roPosterScreen for HMS

After almost 9 years of using my Home Media Server project I have accumulated over 2500 individual videos. HMS is written in BrightScript , and runs on the Roku Players and TVs . When I originally wrote HMS I only had a few hundred videos, so loading times were short. On my older players it can now take several minutes before the user interface is ready to use. This can cause family members to randomly say things like “This is too slow” and “When are you going to fix it?”

Old Design

HMS was using the roGridScreen component to display all of the categories and all of the videos at once. This required loading them up-front, freezing the UI until it was complete. Adding a dialog to indicate how many had been loaded helped, for a while, but watching it count gets boring quickly. I looked at several ways to speed up loading, including simplifying the regex code for parsing out the href links, loading only some of the categories first, and not populating the screen array used for searching. But none of them yielded the results I was looking for.

Experiments

Modifying the regex didn’t speed things up, and loading a partial screen didn’t work out. There is an event you can catch, called isListItemFocused which I thought would allow me to do progressive loading of the next few screens as the user scrolled down through the categories. It ends up that populating a new category also triggers this event, causing it to loop. And because of BrightScript’s design I couldn’t use a lock to keep it from then populating the next few, and the next few, etc. until it had loaded all of them. No improvement to be found there!

SceneGraph or roPosterScreen

Roku has introduced a new framework, called SceneGraph , which may be able to do what I need, but that would take a complete rewrite as well as learning a new framework. Instead I took a look at the other primary BrightScript screen component, roPosterScreen . I’ve never really been a fan of this layout, but I gave it a try. Experiments showed that the item list was re-loaded whenever a new category is selected, and that I didn’t need to load everything at startup. This was exactly what I needed.

roPosterScreen

The rewrite was pretty simple after I decided to drop support for searching. I don’t use it much and it means I don’t have to load everything at startup just for the search. Now it populates the categories from the top level directories, and then it only loads the movies for the last selected category, retrieved from the keystore server . The movies are cached so that they can be displayed quickly when re-visiting a category.

HMS Using roPosterScreen

Deprecated components

Both the roGridScreen and the roPosterScreen components are deprecated, with removal planned for January 1st, 2019. My older roku players are no longer receiving updates so this won’t be a problem with them, but I will have to move to SceneGraph sometime before this. Probably during Christmas Vacation 2018.