Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/plugins/video-mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5612,6 +5612,26 @@ export const videoMode = (options: VideoModeOptions = {}): VideoModePlugin => {
if (racedHighlightStarts.length > 0) {
state.sourceRange.start = Math.min(...racedHighlightStarts);
}
// The mirror case: a start a sliver BEFORE the first highlight. That
// sliver is raw footage from the recording's very first frames —
// exactly the frames a lagging screencast hasn't truthfully
// captured (on a slow runner the recorder's first frames can
// already show the action's result: a filled field before its
// reveal). A lead-in shorter than the fill stabilization window
// is not worth keeping; open on the first highlight instead.
const firstHighlightStart = Math.min(
...highlights.map((candidate) => candidate.start),
);
const leadInToleranceMs =
Math.max(0, timelineOffset) +
rawVideoInfo.frameDurationMs * VIDEO_MODE_FILL_PRE_ACTION_FRAME_PADDING;
if (
Number.isFinite(firstHighlightStart) &&
state.sourceRange.start < firstHighlightStart &&
firstHighlightStart - state.sourceRange.start <= leadInToleranceMs
) {
state.sourceRange.start = firstHighlightStart;
}
}
const annotationSourceRange = metadataFor(state).sourceRange;
const sourceRange = translateSourceRange(annotationSourceRange, timelineOffset);
Expand Down
Loading