StreamSwitchSmoothSettings.onSourceChanged property

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.

Signature:

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