scheduleCommand Method

Send a command message to the scheduler using JavaScript objects.

This is the single most powerful API call, and it exposes a rich suite of functions for extensive control.

// callback version (first three arguments are required)
ServiceHandler.scheduler?.scheduleCommand(command, parameters, variables, (res) => {
  let data;
  try {
    data = JSON.parse(res);
  } catch (e) {
    data = { result: res };
  }
  console.log(data);
});

// promise version (results will be parsed for you)
const data = await ServiceHandler.scheduler?.scheduleCommand(command, parameters, variables);
console.log(data);
  • command: String containing the command; see below for options.

  • parameters: JavaScript object of keys and values determined by the command.

  • variables: JavaScript object of variable names and values.

  • callback: Function to be called with a JSON-formatted string of the command results.

Available commands include but are not limited to these:

command
what it does

schedule

Internal version of the scheduleAction command.

macro

High level title playback control.

setTitleInput

Assign an input to the title.

setTitlePosition

Reposition a title in the list.

loadTitle

Load a title from file, and optionally give it a new name, position, and id.

saveTitle

Save the selected title to file.

newTitle

Create a new title.

readTitle

Get detailed information on a title graphic and its variables.

setDynamic

Specify whether a variable is allowed to change in a title by setting dynamic to 1 or 0

downloadImage

Download image from a url or parse from a data: string, save it to temp file, and return the path

getPlayStatus

Get the playback status of the specific title and variables.

getRenderStatus

Get the render status of a title.

getTitlesPlayStatus

Returns a list of all titles and their input and play status.

getInputsPlayStatus

Returns a list of all inputs and play status on the requested channel.

getAllVideoIns

Returns a list of all video devices available for input

getAllAudioIns

Returns a list of all audio devices available for input

isTitleConnected

Returns true if at least one title in the provided channel is connected to one of a list of inputs.

getTitlesConnected

Returns a list of all titles that are connected to the specified input (or all if input is empty).

getTitleControlInfo

Get extensive information for all titles, just one title, or titles connected to the input.

getTitleConnnectInfo

Get all information pertaining to the connection between inputs and titles.

getCachePath

Gets the current location for the specified title’s cache

setCachePath

Sets a unique location to build the cache for the requested title

subscribe

Subscribe for notifications when titles change play state or their data is updated.

unSubscribe

Unsubscribe for notifications when titles change play state or their data is updated.

getSnapShot

Request a rendering of a title with specific variable settings - can be used to preview.

getTitleIcon

Request a rendering of a title, but only if it has changed since last time.

openFileDialog

Open a file browser to select a file and return its full path.

getFileContent

Read a file (or url) and return its data - useful for files that need to be polled for changes.

encodeImage

Encodes an image from a file to a dataUrl for easy display in a web UI.

assignVariable

Assign an input variable to a graphic variable.

popupAssignVariable

Open a popup menu to connect the variable to a field in the title.

openDesigner

Open the title designer with the requested title.

closeDesigner

Close the title designer.

openUrl

Open URL in the default system browser.

... custom message

When using the to field, your message will be passed to passed to other controllers

Note: Most commands can be targeted to a specific channel, and the channel should be specified as a number starting at 0. This is different from the way channels are displayed in the project panel. The tab labeled “Channel 1” is accessed as channel 0.

Example:

// remember, when using the promises version, the response data will be parsed for you
const res = await ServiceHandler.scheduler?.scheduleCommand(
  'downloadImage',
  { url: 'http://my-images.com/image.jpg' },
  {}
);
if (res.success) {
  console.log(`Image downloaded to local cache: ${res.path}`);
  ServiceHandler.scheduler?.scheduleAction(action, inputName, titleId, { 'My Image': res.path });
}

There are many more commands than these, including commands to start and join Zoom meetings, commands to retrieve chat messages from a video conference. For a full description of these and all currently available commands, view the All Commands Reference.

Additionally, we provide a JSON Command Tester included in the API Tour data controller. You can use that controller to easily test each command and copy/paste code directly from it.

Last updated