fix(video): hold final frame through composition

This commit is contained in:
Miguel Ángel
2026-07-16 02:15:01 +00:00
parent 71d7be7921
commit 2e8f871bc8
15 changed files with 352 additions and 90 deletions
@@ -12,11 +12,39 @@ describe("compileHtml", () => {
expect(compiled).toContain('data-end="4"');
});
it("still clamps non-looping media durations to source duration", async () => {
it("preserves an explicit non-looping video slot past source end", async () => {
const html = '<video id="hero" src="hero.webm" data-start="0" data-duration="4" data-end="4">';
const compiled = await compileHtml(html, "/project", async () => 3.125);
expect(compiled).toContain('data-duration="4"');
expect(compiled).toContain('data-end="4"');
});
it("uses natural duration for a video without an explicit slot inside a composition", async () => {
const html =
'<div data-composition-id="root" data-start="0" data-duration="5">' +
'<video id="hero" src="hero.webm" data-start="0">' +
"</div>";
const compiled = await compileHtml(html, "/project", async () => 1);
expect(compiled).toContain('data-duration="1"');
expect(compiled).toContain('data-end="1"');
});
it("uses natural duration for a standalone video without a composition window", async () => {
const html = '<video id="hero" src="hero.webm" data-start="0">';
const compiled = await compileHtml(html, "/project", async () => 1);
expect(compiled).toContain('data-duration="1"');
expect(compiled).toContain('data-end="1"');
});
it("still clamps non-looping audio durations to source duration", async () => {
const html = '<audio id="voice" src="voice.wav" data-start="0" data-duration="4" data-end="4">';
const compiled = await compileHtml(html, "/project", async () => 3.125);
expect(compiled).toContain('data-duration="3.125"');
expect(compiled).toContain('data-end="3.125"');
});