Skip to content

UI builder - Studio API

Overview

Erizos Studio UI Builder added another useful API functions that can be used to easily manipulate the common features of the Erizos Studio.

Api exposes eleven members:

  1. Profiles - Api.profile
  2. Playlist - Api.playlist
  3. Engines - Api.engine
  4. Channels - reached through Api.profile(...).channel(...), or Api.profile.program / Api.profile.preview. There is no Api.channel.
  5. Pages - Api.page
  6. Storage - Api.page.storage
  7. Api.templates - templates.load(system, path, layer?) creates a page in memory from a template.
  8. Api.preview - preview.remote.filter(filter) and preview.remote.refresh().
  9. Api.log - error, warn, info, trace, debug, verbose and detailed, each taking a message and optional metadata, and writing to the Studio log.
  10. Api.request - get(url), post(url, body), put(url, body) and del(url, body).
  11. Api.layout - layout.set(path) switches the Studio layout.

Api.engines and Api.profiles are read-only arrays of every engine and every profile. See Classes for the full type.

Warning

Api.templates.load(...) is fire-and-forget. The template is loaded, but the promise it returns never settles, so awaiting it hangs the rest of your handler. Call it without await.

This is useful when users wants to have additional control of the functionalities that they commonly use and want to add to their Show UIs and Template UIs such as Taking IN of Pages, change of Engines, moving from one Page to another. etc.

In this example, we utilised the Playlist API and read the Page by asking for the PageID of the Page we want to read, we can also read the next or previous page by simply calling the API.

Download ezUI File

Read Page API

function getPageID(id){
  if (id.value)
    return id.value;
}

// PLAYLIST APIs
readNext_BT.onClick = () => Api.playlist.readNext();
readPrev_BT.onClick = () => Api.playlist.readPrev();
readPage_BT.onClick = () => Api.playlist.readPage(getPageID(pageIDPlaylist_TI));

// target a named playlist
Api.playlist('My Playlist').readNext();

Info

The three script-global storages globalStorage, localStorage and sessionStorage are not part of Api. They are a different API from Api.page.storage, which is per-page data stored in the page itself. See Storage.