feat(playlist): seamless playback of selected shots, cut only
Deploy / deploy (push) Successful in 3m12s

Check shots on the Playlist page and "Play selection" plays them back to
back without slate or handles. The cut comes from the version's handle and
slate metadata (new cutSpan in lib/handles); the media is never changed.

SequencePlayer double-buffers two videos: the next clip is parked a few
frames before its cut-in and pre-rolled hidden, the outgoing clip pauses on
its last cut frame, and the cut fires on the incoming clip's cut-in frame
(requestVideoFrameCallback), with the start time calibrated at each cut.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
twotalesanimation
2026-09-26 08:55:46 +02:00
parent 824695ef30
commit b596c97faf
5 changed files with 1087 additions and 12 deletions
+33 -1
View File
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
import { computeEditRange, frameRegion, isHandleFrame } from "./handles";
import { computeEditRange, cutSpan, frameRegion, isHandleFrame } from "./handles";
describe("computeEditRange", () => {
it("is null when no handles are marked", () => {
@@ -92,3 +92,35 @@ describe("frameRegion", () => {
expect(isHandleFrame(range, 1)).toBe(true);
});
});
describe("cutSpan", () => {
it("plays the cut when handles are marked, skipping slate and handles", () => {
// 1 slate + 8 head + 84 cut + 8 tail = 101 MP4 frames
expect(cutSpan({ handleHead: 8, handleTail: 8, frameCount: 100 }, 101)).toEqual({
start: 9,
end: 93,
});
});
it("plays the whole picture minus the slate when no handles are marked", () => {
expect(cutSpan({ frameCount: 100 }, 101)).toEqual({ start: 1, end: 101 });
expect(cutSpan({ pictureStartFrame: 2 }, 50)).toEqual({ start: 2, end: 50 });
});
it("plays the whole media when nothing is known about it", () => {
expect(cutSpan(null, 48)).toEqual({ start: 0, end: 48 });
expect(cutSpan({}, 48)).toEqual({ start: 0, end: 48 });
});
it("is null until the media length is known", () => {
expect(cutSpan({ handleHead: 8, handleTail: 8 }, 0)).toBeNull();
});
it("never returns an empty span", () => {
// Handles longer than the picture
expect(cutSpan({ handleHead: 30, handleTail: 30, frameCount: 40 }, 40)).toEqual({
start: 0,
end: 40,
});
});
});