Skip to content

Commit 73de4fd

Browse files
committed
fix(core): a timing change during playback re-decides every clip on that frame
1 parent 0ae68dd commit 73de4fd

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

‎packages/core/src/runtime/init.playbackScope.test.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,20 @@ describe("a playing frame's scope", () => {
190190
expect(quietFrames).toBeGreaterThan(20);
191191
});
192192

193+
it("shows a clip on the next frame when its timing moves it onto the playhead mid-play", async () => {
194+
mountFilm();
195+
window.__player!.play();
196+
while (window.__player!.getTime() < 5) frames(1);
197+
const moved = document.getElementById("e")!;
198+
const stretched = document.getElementById("a")!;
199+
expect([moved.style.visibility, stretched.style.visibility]).toEqual(["hidden", "hidden"]);
200+
moved.setAttribute("data-start", "4");
201+
stretched.setAttribute("data-duration", "19");
202+
await Promise.resolve();
203+
frames(1);
204+
expect([moved.style.visibility, stretched.style.visibility]).toEqual(["visible", "visible"]);
205+
});
206+
193207
it("leaves a scene that ended alone while the film plays on, after resting it at its end once", () => {
194208
const scene = countingTimeline(8);
195209
document.body.innerHTML =

‎packages/core/src/runtime/init.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2923,6 +2923,7 @@ export function initSandboxRuntimeModular(): void {
29232923
if (decisionEdgesRevision !== timingRevision) {
29242924
decisionEdges.clear();
29252925
decisionEdgesRevision = timingRevision;
2926+
return null;
29262927
}
29272928
const windowOptions = {
29282929
timelineRegistry: window.__timelines ?? {},

0 commit comments

Comments
 (0)