StreamSwitchSmoothNode.switchSource() method

Switches the source used for the current output of this node.

The target pin must already be carrying streams. A pin whose source has not produced a context yet — a fileMp4 opened with start: 'paused' and not yet played, an SRT caller still connecting — is refused by the engine ("Source not present in subscribed pins" or "Source audio/video not active"), and the switcher stays where it was. The refusal is reported through StreamSwitchSmoothSettings.onSwitchError and returned as the StreamSwitchResult; the promise resolves either way once the engine has answered, never rejects. To switch to a source that is about to appear, sequence on the pin’s context rather than on the promise: play the source, wait for it in StreamSwitchSmoothSettings.onInboundContextChange (or StreamSwitchSmoothSettings.onSourceChanged), then switch. reflects the engine’s answer, not the request.

Signature:

switchSource(newSource: Pins, options?: StreamSwitchSmoothSwitchOptions): Promise<StreamSwitchResult>;

Parameters

Parameter Type Description

newSource

Pins

options

StreamSwitchSmoothSwitchOptions

(Optional)

Returns: