Roku is one of the leading streaming players available in the market. It allows users to stream audio/video content via the Internet.
There are 3 main requirements to make a Roku channel:
- Original and/or licensed video content (content publishers)
- Hosted content available through the Internet (OVP, CDN, etc.)
- Built using SDK (Brightscript programming language) / Direct Publisher (JSON/RSS feed)
We’re going to build the app using the SDK as it allows us to do tons of customization and incorporate our own workflow into the app, which cannot be done in the Direct published.
Programming Language & IDE
Roku channels are built using Brightscript programming language ,which is a proprietary language. We can use the plugin for Eclipse IDE (installation instruction), which is provided by Roku itself, so we don’t have to bother ourselves by using some other text-editor. The plugin has the ability to deploy your app from eclipse to your TV and check it directly.
We can start creating a simple channel by modifying the code from the sample channels available here.
The app is built on top of simple grid screen with tons of customization like custom login screen and multiple categories, with each category added in background without making user wait for all the data to be available. With the help of Registry we store the user’s information and provide a personalized experience.
To get started we thought of creating multiple scenes and switch among them if user is already logged-in. But we found that it’s complex to create multiple scenes. Instead we went with single scene which is built using SceneGraph.
The confusing part is when you have many views/dialog/keyboardDialog and you want to switch to a new view, then the older view’s focus and visibility must be set to false. Otherwise the top view won’t be able to receive any action even though you would be able to view them.
Another quick fix is, when you’re deep into your component tree and want to show a dialog for example, then m.top.dialog might not work, instead try m.top.getScene().dialog = dialog.
In Roku your HTTP requests cannot be made on the main thread, you need to create a TASK for it to perform the HTTP call and receive the data.The same applies when accessing roRegistrySection. The response obtained from the HTTP request can be structured with inbuilt functions,for JSON objects we use ParseJSON() and for XML objects you need to create roXMLElement variable. To learn more about HTTP requests check here.
Overall there were some challenges along the way and exciting to learn & try something new. You can install StudioSWEATOnDemand channel from here.