StreamSwitchSmoothSettings interface

Settings for the Smooth Source Switch see NorskControl.streamSwitchSmooth()

Signature:

export interface StreamSwitchSmoothSettings<Pins extends string> extends ProcessorNodeSettings<StreamSwitchSmoothNode<Pins>>

Properties

Property Type Description

activeSource?

Pins

(Optional) The presently active source being used to generate output for this node

alignment?

"aligned" | "not_aligned"

(Optional) Alignment behaviour of the component whether to rebase all incoming streams to a common timeline Note: This will modify the timestamps, meaning that merging streams not involved in this may result in operation may result in sync issues. To avoid this, you can use NorskTransform.streamAlign() instead of relying on this component for this behaviour Note: This behaviour may be removed in a future release and replaced with something similar

audioLatencyMs?

number

(Optional) Latency in milliseconds for the audio gap filler. Higher values allow better concealment of gaps/overlaps at the cost of added audio delay. Defaults to 0 (no latency).

channelLayout

ChannelLayout

The constant channel layout that all output audio will be resampled to

frameRate

FrameRate

The constant framerate that all output video will be sampled to

hardwareAcceleration?

StreamSwitchSmoothHardwareAcceleration

(Optional) Optionally attempt to perform the compose operation on hardware

maxQueueMs?

number

(Optional) Maximum duration to hold any stream in the case that one or more are running behind. In the case the late stream is delayed rather than having a large gap, this will result in discarded input frames.

onFirstFrame?

(pin: Pins, streams: StreamMetadata[]) ⇒ Promise<"hold" | "passthrough" | { hold?: boolean; release?: Pins; }>

(Optional) Called on the first frame of any source pin. Return "hold" to queue frames for that pin (for preloading), or "passthrough" to let them flow normally. Return an object form (e.g. { release: "other" } or { hold: true, release: "other" }) to additionally release another held pin atomically as part of the same decision.

onInboundContextChange?

(allStreams: Map<Pins, StreamMetadata[]>) ⇒ Promise<void>

(Optional) Callback to be called when inbound context changes on some input; presence of an input means that media has arrived and is ready to switch immediately

onSourceChanged?

(pin: Pins, streams: StreamMetadata[]) ⇒ Promise<"hold" | "passthrough" | void | { hold?: boolean; keep?: boolean; release?: Pins; trim?: boolean; }>

(Optional) Called whenever the visible stream count for a source pin changes (grows or shrinks but not to zero). Return "hold" to start queueing frames for that pin, "passthrough" to release a held pin and let frames flow, or undefined to acknowledge the change without altering the pin’s current hold/passthrough state. Return an object form (e.g. { hold: true, release: "other" } or { release: "other" }) to additionally release another held pin atomically as part of the same decision. Return { trim: true } to declare the source is winding down — any remaining frames on this pin are dropped at the preload stage until its onSourceEnded fires. This callback blocks context propagation until it returns.

onSourceEnded?

(pin: Pins, lastSeenPts: number | undefined, lastSeenVideoPts: number | undefined) ⇒ Promise<{ release?: Pins; } | void>

(Optional) Called when a source’s streams disappear on a pin (e.g. file ended). This callback blocks context propagation - use it to set up the next source before returning.

lastSeenPts (microseconds) is the last PTS this switch’s engine emitted from the ending pin across ALL streams (max END-OF-FRAME of audio + video + any fill).

lastSeenVideoPts (microseconds, optional) is the video-stream-only end-PTS. Prefer this when feeding back as anchorPts to a sibling switch whose downstream is a hard switch (streamSwitchHard) gating on video-only lastOutput — if the ending source’s audio tail extends past its last video frame, lastSeenPts would overshoot the hard switch’s video-only lastOutput and the sibling’s IDR would be dropped at the gate. Falls back to undefined when the ending pin had no emitted video (in which case use lastSeenPts).

onSwitchError?

(message: string, inputPin?: Pins) ⇒ void

(Optional) Callback which will be called if a switch request cannot be fulfilled

onTransitionComplete?

(inputPin: Pins) ⇒ void

(Optional) Callback which will be called a transition has succesfully completed for a requested switch, i.e. the new source is now showing.

Note that if additional transitions are triggered when a transition is already in progress, a notification may only be given for the last transition to finish.

outputResolution

Resolution

The constant resolution that all output video will be scaled to

outputSource

string

The source name given to the output of this node

pipelineHints?

QuadraPipelineHints

(Optional) Extra options for influencing how the pipeline gets constructed and what algorithms get used for certain operations. Silently ignored when the operation does not run on Quadra hardware.

sampleFormat?

SampleFormat

(Optional) The sample format of the built outgoing stream (Defaults to FLTP)

sampleRate

SampleRate

The constant samplerate that all output audio will be resampled to

startAudioStreamId?

number

(Optional) Starting stream ID for the output audio stream (default 2)

startVideoStreamId?

number

(Optional) Starting stream ID for the output video stream (default 1)

transitionDurationMs?

number

(Optional) How many milliseconds to use for the fade operation between two sources