0

I would like to build a Roku SceneGraph experience built incrementally from XML components shipped off from a remote server. That is to say, enable a Roku channel to drive a SceneGraph experience using components that are not all included as part of the XML and brs files under the component/ folder shipping with the channel, but rather, downloaded from the Internet dynamically.

The analogy is a web browser with html as the declarative markup language (although that is not my specific goal).

I saw reference to SceneGraph files being compiled on channel startup based on what is present under component/. There doesn't seem to be a way to generate a roSGNode from XML, for instance.

I did a bit of research but came up empty handed. Curious to know if anyone else thought this space through before?

Episcopus
  • 165
  • 1
  • 1
  • 8

2 Answers2

1

In short I don't think a SceneGraph channel can dynamically load XML-defined components that aren't stored as part of the channel package.

However that doesn't necessarily mean you can't build a dynamic channel.

You might be able to at least run Brightscript code that are sent server-side by using the Run() or Eval() functions https://sdkdocs.roku.com/display/sdkdoc/Runtime+Functions

A lot can be done programmatically with Brightscript, e.g. you can add components and fields for those components.

Ish
  • 1,855
  • 5
  • 24
  • 32
  • Right, that was my impression, and thanks for the response. I did some testing on dynamic behavior through downloaded BrightScript and you are able to run that code, however it appears totally sandboxed from the rest of the application. So short or using `tmp:/` files to exchange data or similar, it doesn't appear that this technique is viable either. – Episcopus Nov 02 '18 at 16:06
  • What if you send a set of instructions down as JSON or XML with .brs snippets and then have a parser that then parses and then uses Run() or eval(). You could even build your own parser to just process SceneGraph XML definitions (might not be that hard since I think there are already ParseXML functions provided by Roku) and you would just have to map the parsed elements to an instruction set (e.g. createComponents, add Field, etc) – Ish Nov 02 '18 at 19:01
  • and if you do please open source it! – Ish Nov 02 '18 at 19:01
0

Roku SceneGraph does have a ComponentLibrary (https://sdkdocs.roku.com/display/sdkdoc/ComponentLibrary) that lets you provide components (xml & brs) by downloading them at runtime. There used to be a restriction that the component library had to be packaged as a .pkg file and signed with the same dev key as the app running the code, but since v7.5, that restriction has been lifted as long as the components are served over HTTPS. From the link above:

"Unsigned Component Libraries

Available since firmware version 7.5

Component libraries no longer need to be packaged or signed with the same devid as the channel starting with firmware version 7.5. However, unsigned component libraries are required to be served over HTTPS before they can be accessed by published channels. See additional cases below:

Sideloaded channels can access unsigned component libraries over HTTP or HTTPS.
Published channels can only access unsigned component libraries over HTTPS.
Published channels can access signed component libraries over HTTP if the channel and the library share the same devid."

You could use this functionality to provide dynamic xml/brs files at runtime.

briandunnington
  • 423
  • 2
  • 9