Skip to main content

Dynamically constructing a workflow

What you'll learn
  • How to add, update and connect components in a workflow session

Key Concepts

  • Adding components to a session: Components are the building blocks of your workflow. Each component represents a specific function like input sources, mixers, or output destinations. Components are added via POST requests to the session's components endpoint and must have unique componentId values for identification and control.

  • Creating Links between components: Links establish the data flow between components by connecting output pads to input pads. Each pad has a unique name that's referenced when creating the link. Links are unidirectional and define how audio/video data flows through your workflow pipeline.

  • Updating Properties on a component: After components are added to a session, their properties can be dynamically modified using PATCH requests. This allows real-time control over component behavior, such as enabling/disabling outputs, adjusting audio/video settings, or starting/stopping recordings without rebuilding the workflow.

Adding a Live Input Source

A live input source that can receive via various protocol including RTMP, SRT and WHIP and bring their data into your workflow session.

Properties

PropertyDescription
typeliveInputSource
liveInputIdThe ID of the pre-configured live input
componentIdUnique identifier for controlling and updating the component
displayNameHuman-readable name displayed in UI and workflow
outputOutput pad configuration for connecting to other components

API Request

Endpoint: POST /sessions/{{workflowSessionId}}/components

{
"component": {
"type": "liveInputSource",
"liveInputId": "7579d062-1234-4ed6-b122-756737cd38ac",
"componentId": "rtmp1",
"displayName": "rtmp input component",
"output": {
"name": "output",
"displayName": "live input output"
}
}
}

Adding a Mixer Component

A mixer combines multiple input sources into a single output and allows real-time video and audio transformations.

Configuration Notes
  • This example shows a single-input mixer
  • Input names serve as unique identifiers for executing commands
  • Each input can be independently transformed

Mixer Properties

PropertyDescription
typemixer
componentIdUnique identifier for controlling and updating the component
displayNameHuman-readable name displayed in UI and workflow
outputOutput pad configuration for downstream connections
inputsArray of input configurations with video/audio transformation properties

API Request

Endpoint: POST /sessions/{{workflowSessionId}}/components

{
"component": {
"type": "mixer",
"componentId": "mixer1",
"displayName": "mixer",
"output": {
"name": "output",
"displayName": "mixer output"
},
"inputs": [
{
"name": "input 1",
"displayName": "Live Input 1",
"video": {
"active": true,
},
"audio": {
"mute": false
}
},{
{
"name": "watermark",
"displayName": "Image watermark",
"video": {
"active": false,
},
"audio": {
"mute": true
}
}
}
]
}
}

Connecting Components

Live Input to Mixer

Create a link to establish data flow from the live input source to the mixer.

Endpoint: POST /sessions/{{workflowSessionId}}/links

{
"link": {
"source": {
"componentId": "rtmp1",
"padName": "output"
},
"target": {
"componentId": "mixer1",
"padName": "input 1"
}
}
}

Adding a Live Output Destination

Live output destinations send your workflow stream to third-party endpoints via RTMP, SRT, or WHIP protocols.

Component Properties

PropertyDescription
typeliveOutputDestination
liveOutputIdThe ID of the pre-configured live output
componentIdUnique identifier for controlling and updating the component
displayNameHuman-readable name displayed in UI and workflow
inputInput pad configuration for receiving stream from upstream component
enabledBoolean flag controlling whether the output is actively transmitting

API Request

Endpoint: POST /sessions/{{workflowSessionId}}/components

{
"component": {
"type": "liveOutputDestination",
"liveOutputId": "a3782cd7-xyz1-441d-85ca-58500bb3f695",
"componentId": "liveOutput1",
"displayName": "Live output destination name",
"input": {
"name": "input",
"displayName": "rtmp destination input"
},
"enabled": false
}
}

Mixer to Live Output

Establish data flow from the mixer to the live output destination.

Endpoint: POST /sessions/{{workflowSessionId}}/links

{
"link": {
"source": {
"componentId": "mixer1",
"padName": "output"
},
"target": {
"componentId": "liveOutput1",
"padName": "input"
}
}
}

Activating the Live Output

Enable the live output destination to begin transmitting to the configured third-party endpoint.

API Request

Endpoint: PATCH /sessions/{{workflowSessionId}}/components/liveOutput1

{
"values": {
"enabled": true
}
}

Enabling recording on the Mixer

Enable recording on the mixer component to for later use.

API Request

Endpoint: PATCH /sessions/{{workflowSessionId}}/components/mixer1

{
"values": {
"recordingEnabled": true
}
}