commit 3266fac3f86e06abb2aa5a343130005a54097ed4
parent 95ac33ab49d8528812c5643581e875b22cd0151b
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 3 Nov 2026 11:25:23 -0500
umtool: Play's fast-forward SPEEDS a post item up instead of skipping through it -- Play gives the post item its rate, so the attachment and the voice play at it, where they played at 1x and were re-seeked every 0.3 s of drift (operator: "it seems like it's just skipping rather than actual speeding up")
e2e (post-narration.spec.ts): at 2x the item's clock, its video and its voice
all advance ~2x with no re-seek; a cut rate of 1.25 plays the voice at 1.25x on
a 1x clock and the read ends at lead + take / rate.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 72 insertions(+), 1 deletion(-)
diff --git a/umtool/components/projects/review/PlayCut.tsx b/umtool/components/projects/review/PlayCut.tsx
@@ -833,6 +833,7 @@ export default function PlayCut({
box={box2}
s={Math.max(0, t - postNow.item.start)}
playing={ui.playing && !ui.waiting}
+ speed={rate}
/>
) : null;
const placeholderCard = placeholder ? (
diff --git a/umtool/e2e/post-narration.spec.ts b/umtool/e2e/post-narration.spec.ts
@@ -1,6 +1,6 @@
import { test, expect, type Page } from "@playwright/test";
import { execFileSync } from "node:child_process";
-import { copyFileSync, existsSync, mkdirSync, readFileSync, rmSync } from "node:fs";
+import { copyFileSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import * as urls from "./urls";
@@ -76,6 +76,76 @@ test("Play plays the take over the attachment, muffled under the read, then open
await page.locator("[data-play-toggle]").click();
});
+/** Over `ms` of wall time inside the page: how far the item's clock, its video and its voice moved, and how often the video seeked. */
+const sampleSpeed = (page: Page, id: string, ms: number) =>
+ page.evaluate(async ({ id, ms }) => {
+ const p = document.querySelector(`[data-post-play="${id}"]`)!;
+ const v = p.querySelector("video[data-post-video]") as HTMLVideoElement;
+ const a = document.querySelector("[data-post-narration-audio]") as HTMLAudioElement;
+ let seeks = 0;
+ const on = () => (seeks += 1);
+ v.addEventListener("seeking", on);
+ const s0 = Number(p.getAttribute("data-post-s")), v0 = v.currentTime, a0 = a.currentTime, w0 = performance.now();
+ await new Promise((r) => setTimeout(r, ms));
+ v.removeEventListener("seeking", on);
+ return { ds: Number(p.getAttribute("data-post-s")) - s0, dv: v.currentTime - v0, da: a.currentTime - a0, dw: (performance.now() - w0) / 1000, seeks, vr: v.playbackRate, ar: a.playbackRate };
+ }, { id, ms });
+
+test("FAST-FORWARD SPEEDS A POST ITEM UP (operator, 3 Nov: \"it's just skipping rather than actual speeding up\"): at 2x the clock, the video and the voice all run at 2x, no seeks", async ({ page }) => {
+ await page.setViewportSize({ width: 1366, height: 1000 });
+ await page.goto(urls.playHref(PROJECT, { bare: true, clip: "p-11" }));
+ await expect(root(page)).toHaveAttribute("data-play-item", "p-11");
+ const player = page.locator('[data-post-play="p-11"]');
+ await expect(player).toHaveAttribute("data-post-step", "video");
+ await page.locator("[data-play-rate]").selectOption("2");
+ await page.locator("[data-play-toggle]").click();
+ await expect(player).toHaveAttribute("data-post-narration-playing", "1", { timeout: 15_000 });
+ await expect(page.locator("video[data-post-video]")).toHaveAttribute("data-post-video-rate", "2");
+ await expect(page.locator("[data-post-narration-audio]")).toHaveAttribute("data-post-narration-rate", "2");
+ const r = await sampleSpeed(page, "p-11", 600);
+ // The clock at ~2x wall time; the video and the voice moving with it (played, not jumped); no re-seek.
+ expect(r.ds / r.dw).toBeGreaterThan(1.6);
+ expect(r.ds / r.dw).toBeLessThan(2.4);
+ expect(r.vr).toBe(2);
+ expect(r.ar).toBe(2);
+ expect(r.dv / r.ds).toBeGreaterThan(0.75);
+ expect(r.dv / r.ds).toBeLessThan(1.25);
+ expect(r.da / r.ds).toBeGreaterThan(0.75);
+ expect(r.da / r.ds).toBeLessThan(1.25);
+ expect(r.seeks).toBeLessThanOrEqual(1);
+ await page.locator("[data-play-toggle]").click();
+});
+
+test("THE READ's RATE in Play: render.postNarration.rate 1.25 plays the voice at 1.25x on a 1x clock, the read 1.6 s of the item, the attachment at 1x", async ({ page }) => {
+ const m = JSON.parse(readFileSync(MANIFEST, "utf8"));
+ m.render = { ...(m.render ?? {}), postNarration: { ...(m.render?.postNarration ?? {}), rate: 1.25 } };
+ writeFileSync(MANIFEST, JSON.stringify(m, null, 2) + "\n");
+ await page.setViewportSize({ width: 1366, height: 1000 });
+ await page.goto(urls.playHref(PROJECT, { bare: true, clip: "p-11" }));
+ await expect(root(page)).toHaveAttribute("data-play-item", "p-11");
+ const player = page.locator('[data-post-play="p-11"]');
+ await page.locator("[data-play-toggle]").click();
+ await expect(player).toHaveAttribute("data-post-narration-playing", "1", { timeout: 15_000 });
+ await expect(page.locator("[data-post-narration-audio]")).toHaveAttribute("data-post-narration-rate", "1.25");
+ await expect(page.locator("video[data-post-video]")).toHaveAttribute("data-post-video-rate", "1");
+ const r = await sampleSpeed(page, "p-11", 600);
+ expect(r.ar).toBe(1.25);
+ expect(r.vr).toBe(1);
+ expect(r.da / r.ds).toBeGreaterThan(1.25 * 0.8);
+ expect(r.da / r.ds).toBeLessThan(1.25 * 1.2);
+ // The 2 s take reads in 1.6 s: the voice stops at 0.4 + 1.6 = 2.0 s of the item, the muffle ends 0.3 s later.
+ // Read in the page the moment it stops (a poll from here would land late).
+ const sAtStop = await player.evaluate((el) => new Promise<number>((resolve) => {
+ const done = () => el.getAttribute("data-post-narration-playing") === "0" && (resolve(Number(el.getAttribute("data-post-s"))), true);
+ if (done()) return;
+ const mo = new MutationObserver(() => done() && mo.disconnect());
+ mo.observe(el, { attributes: true, attributeFilter: ["data-post-narration-playing"] });
+ }));
+ expect(sAtStop).toBeGreaterThan(1.9);
+ expect(sAtStop).toBeLessThan(2.3);
+ await page.locator("[data-play-toggle]").click();
+});
+
test("four pictures cycle beside the card while it is read; the words stay up the whole item", async ({ page }) => {
await page.setViewportSize({ width: 1366, height: 1000 });
await page.goto(urls.postBenchHref(PROJECT, "p-12"));