Skip to content

Commit 3b2e72d

Browse files
committed
test(runtime): a speed-ramped video that runs to the composition end holds its last frame
Covers the composition of the terminal hold with a rate lane: at a time past the clip end the video sits at the source time of its own end.
1 parent db742bb commit 3b2e72d

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

‎packages/core/src/runtime/media.test.ts‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import {
88
} from "./media";
99
import type { RuntimeMediaClip } from "./media";
1010
import { resolveNaturalMediaTimelineDuration } from "./playbackRate";
11+
import { sourceTimeAt } from "../speedRamp";
12+
import type { HfAutomationLane } from "../audioAutomation";
1113

1214
// Most cases predate the terminal rule and run with no composition end to hold at.
1315
const syncRuntimeMedia = (
@@ -828,6 +830,27 @@ describe("syncRuntimeMedia", () => {
828830
expect(clip.el.play).not.toHaveBeenCalled();
829831
});
830832

833+
it("holds a speed-ramped video that runs to the composition end at the source time of its own end", () => {
834+
const lane: HfAutomationLane = {
835+
target: "rate",
836+
points: [
837+
{ t: 0, v: 1 },
838+
{ t: 5, v: 2 },
839+
],
840+
};
841+
const clip = createMockClip({ start: 0, end: 5, duration: 5, sourceDuration: 100, rate: lane });
842+
syncRuntimeMedia({
843+
clips: [clip],
844+
timeSeconds: 6,
845+
playing: false,
846+
playbackRate: 1,
847+
getCompositionDuration: () => 5,
848+
});
849+
expect(clip.el.currentTime).toBeCloseTo(sourceTimeAt(lane, 5), 5);
850+
expect(clip.el.currentTime).toBeLessThan(sourceTimeAt(lane, 6));
851+
expect(clip.el.play).not.toHaveBeenCalled();
852+
});
853+
831854
it("clamps a terminal video hold to a shorter source tail", () => {
832855
const clip = createMockClip({ start: 0, end: 5, duration: 5, sourceDuration: 0.25 });
833856
syncRuntimeMedia({

0 commit comments

Comments
 (0)