Switch the source of a running Live stream
Available in: UI · API
Use this how-to when the Channel feeding a running Live stream must be swapped — for example to roll from a studio camera to a remote contribution, or to recover from a stuck input by pointing at a known-good fallback Channel. The runtime operation is runtimeApplySourceSwitch; it persists the new input and the encoder reconciles within a few seconds.
When to use this
When the input Channel must change while the broadcast remains on air, without interrupting the Destinations. Cross-type swaps (for example SRT → Youtube Live) are not supported online — for those, stop the Live stream, edit the bound Channel and start it again.
Prerequisites
- A Live stream that is currently running (
LiveStream.status = 1). - A user with the Operator or System Administrator role.
- A destination Channel that satisfies the eligibility rules below.
Eligibility rules
The backend enforces every rule with HTTP 422. The UI mirrors them so the tab is disabled when a switch is not possible.
- The Live stream is running.
LiveStream.statusmust be1(Live). - The destination Channel is reachable from the encoder. A Channel pinned to a different encoder Device fails with
APIf526. VirtualChannel.typevalues —SRT,Stream,RTMP-Push,SRT Cloud,UDP-R Cloud,NDI,Youtube Live— have no encoder pin and are reachable from any encoder. - The destination Channel has the same Channel type as the current source. Cross-type swaps fail with
APIf527. - The current source type is one of the online-switch-supported types. Supported
Channel.typevalues as the current source:SRT,Stream,RTMP-Push,SRT Cloud,UDP-R Cloud,NDI,Youtube Live. Unsupported:SDI,AES/EBU,File— a switch attempt while one of these is the live source fails withAPIf528.
The UI groups the three cloud-push variants (RTMP-Push, SRT Cloud, UDP-R Cloud) under the umbrella label Stream – C21 Live Cloud in the Channel type picker; the eligibility checks above resolve against the underlying enum values. See Sources for the full Channel.type enum.
Via UI
Navigation: On air → <row> → Source switch tab in the runtime panel.
Open the runtime panel
Click the row of the running Live stream on On air to expand its runtime panel.
Switch to the Source switch tab
Click the Source switch icon (export.svg) in the runtime cluster. The panel filters the list of alternatives to Channels that are eligible per the rules above: same encoder, same Channel type, enabled, not the current Channel.
If no alternatives are eligible, the panel renders an explanation message instead of the picker.
Pick the new Channel and submit
Pick the target Channel from the list and submit. The new input lands on the output within a few seconds.
Via API
| Action | Method + path | operationId |
|---|---|---|
| Switch the source | POST /c21apiv2/livestreams/{id}/runtimeOptions/sourceSwitch | runtimeApplySourceSwitch |
curl -X POST "https://<your-host>/c21apiv2/livestreams/<livestreamId>/runtimeOptions/sourceSwitch" \
-H "Authorization: Bearer <YOUR_API_TOKEN>" \
-H "Content-Type: application/json" \
-d '{ "channelId": <target Channel id> }'
Body:
| Field | Notes |
|---|---|
channelId | Integer id of the destination Channel. Must reference an existing Channel that satisfies the eligibility rules above. |
Response data. { channelId, applied_at, changed, warning? }. changed: false means the broadcast was already pointing at this Channel (idempotent skip). warning is present only when the encoder did not acknowledge in time; the state is persisted and the encoder reconciles on its own.
Error codes (HTTP 422):
| Code | Cause |
|---|---|
APIf526 | Destination Channel is on a different encoder Device. |
APIf527 | Destination Channel has a different Channel type than the current source. |
APIf528 | Current source type is not supported for online source switching (SDI, AES/EBU or File). |
No effect on the configured source. The switch only writes the runtime mirror of the source. A subsequent stop and start reverts to the source configured on the Live stream — to keep the new Channel after a restart, edit the Live stream's bound Channel as well.
Verify
GET /c21apiv2/livestreams/{livestreamId}returns the updated Source (Channel) on the Live stream's options panel.- The Channel entrypoint on the row in On air reflects the new bound Channel.
- The output stream switches over within a few seconds.
FAQ
422 with the specific error code, and the broadcast keeps its current source. Stop the Live stream, re-bind it to the new Channel and start it again.Black out or replace the program on a running Live stream
Cut to a black frame, replace the output with a media file, or return to the live input — without stopping the broadcast.
Toggle a Publishing mid-broadcast
Enable or disable a Publishing on a running Live stream without restarting the broadcast.