App Resources

Resources are the the staic contents that you would use in your application, YodaOS defines the following:

  • multimedia files
  • light scripts
  • (user interface strings)
  • (voice interface templates)
  • (layout definitions)

() means not implemented yet.

And resources are owned by system and applications, we use a URI to present where these files are on, for example, to access the system resources:'system://ring.ogg');'system://wakeup.js');

Application is able to store itself resources:'self://my-music.mp3');'self://my-cool-effect.js');


The system media files are stored at /opt/media/, to view the list of those files:

$ ls /opt/media/

And the application multimedia directory is on ${APP_DIRECTORY}/media, just use the self:// protocol to access:'self://foobar/startup.ogg');

This reads the media file ${APP_DIRECTORY}/media/foobar/startup.ogg, and start playing. For the complete API about media, see yodaRT.activity.Activity.MediaClient.

Light Scripts

Every light effect could be writtern as a JavaScript file:

module.exports = function (context, params, callback) {
  context.pixel(10, 255, 255, 255, .7)
  context.requestAnimationFrame(() => {
    context.fill(100, 100, 100, .7)

The context provides all the convient write functions:

  • pixel is to write to a single light.
  • fill is to write to all the lights.
  • requestAnimationFrame is the same function at browser, but within an explict timeout after callback.

See yodaRT.LightRenderingContext for the complete APIs on the context.

The params is passed through the, it could be used to control what the effect should be. And callback is the function which should be called, when the light is finished.

The system light scripts are stored at /opt/light, and the application's is at ${APP_DIRECTORY}/light, for example:'self://test/e1.js')

This would requires from ${APP_DIRECTORY}/light/test/e1.js, and start the function in script.