Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
fix(preview): end a wall-clock element whose duration arrives late
EtienneLescotd0091da915cf
diff --git a/src/components/ai-edition/wallClock.test.ts b/src/components/ai-edition/wallClock.test.tsindex e1e7cd1d0..4dac5bd4f 100644--- a/src/components/ai-edition/wallClock.test.ts+++ b/src/components/ai-edition/wallClock.test.ts@@ -124,6 +124,21 @@ describe("keepTimeByWallClock", () => {expect(media.currentTime).toBe(0);});+ it("still stops at the end when the duration is learned while playing (a MediaRecorder WebM)", async () => {+ const media = clocked();+ media.duration = Number.NaN;+ const seen = events(media);+ await media.play();+ media.duration = 2;+ media.dispatchEvent(new Event("durationchange"));+ nowMs = 2000;+ vi.advanceTimersByTime(2000);+ await Promise.resolve();+ expect(media.paused).toBe(true);+ expect(media.ended).toBe(true);+ expect(seen).toEqual(["play", "playing", "pause", "ended"]);+ });+it("refuses a rate the element refuses, and keeps its own", async () => {const media = clocked();await media.play();diff --git a/src/components/ai-edition/wallClock.ts b/src/components/ai-edition/wallClock.tsindex bfa6ffcdc..9685acd54 100644--- a/src/components/ai-edition/wallClock.ts+++ b/src/components/ai-edition/wallClock.ts@@ -133,4 +133,7 @@ export function keepTimeByWallClock(rate = rateOf.get?.call(element);anchor(0);});+ // A MediaRecorder WebM can learn its duration after the clock is installed: the end timer+ // needs it, or playback runs on past the end without ever saying `ended`.+ element.addEventListener("durationchange", () => anchor(position()));}