Script Examples
Send Command
In this example, we will create a function that sends a command to the engines in the active profile, via Erizos Studio. This is a preferred method to sending a command directly to the engine, as the action will be handled and logged by Erizos Studio.
In this example, we send a command by calling the UI Builder Studio API, which routes the command through Erizos Studio to the engines of the target channel.
1 | |
The first argument is the system type of the engines the command is meant for - 'UE', 'VIZRT', 'CASPAR_CG' and so on. The command itself is passed through to those engines.
Tip
Api.engine(engineId).sendCommand(command) sends a command to one engine directly, without a system type. The convenience shapes described below for Vizrt and CasparCG are applied only on the profile/channel route, not on this one.
Vizrt and CasparCG
For 'VIZRT' and 'CASPAR_CG', the command may be given as an object, as a plain string, or as an array of strings:
1 2 3 4 | |
A string is wrapped as { command: <string> } and an array as { commands: [...] } before it is sent.
Unreal Engine Examples
An Unreal Engine command is an object with an action property:
| Action | Arguments | Description |
|---|---|---|
SET |
payload (object or JSON string), cache (optional) |
Sets control values on the engine. Throws Missing payload when payload is absent, and Payload is not a valid json object when a supplied JSON string cannot be parsed. |
GET |
- | Returns the current control state of the engine. |
LAUNCH |
project, level, preview (optional), verifyCache (optional) |
Launches Unreal with a project and level. Throws Missing project argument / Missing level argument. |
| (none) | method, url, body |
Any other object is forwarded to the engine as a raw request. method must be GET or POST, url must start with / and is sent exactly as given, so it has to include the plugin's /api prefix. A POST must carry a body. |
This command will set the value of the control component with the ID "01"
1 2 3 4 5 6 7 | |
This command launch Unreal with the Project "ExampleProject" (Saved in the Unreal Projects Folder), and load the "Main" level
1 2 3 4 5 | |
This command reads the current control state back from the engine
1 | |
This command sends a raw request to any endpoint the Erizos Control plugin exposes
1 2 3 4 5 | |