StreamSwitchSmoothSettings.onSourceEnded property
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).
Signature:
onSourceEnded?: (pin: Pins, lastSeenPts: number | undefined, lastSeenVideoPts: number | undefined) => Promise<{
release?: Pins;
} | void>;