AI media harness for planning, generating, and editing locally
TypeScript
Keep timeline playhead moving during playback
Bitti75b755503bff
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.mdindex 1595d48..9c25894 100644--- a/RELEASE_NOTES.md+++ b/RELEASE_NOTES.md@@ -26,6 +26,7 @@ This alpha update adds DMAD LoRA support, resumable model downloads, and improve## Fixes and improvements+- The timeline playhead follows playback without waiting for editor updates.- Copy and paste effect settings between matching effects from their **…** menus, including bypass state and LUT data.- Add voice reference chips directly in a shot's Speech field. Voice guidance stays separate from the words spoken.- Removing a reference from a scene's last prompt citation now removes it from generation inputs and “Used by.” References selected as frame or motion inputs remain active.diff --git a/src/components/workspace/TimelineView.test.tsx b/src/components/workspace/TimelineView.test.tsxindex d6cadb7..ea6d46a 100644--- a/src/components/workspace/TimelineView.test.tsx+++ b/src/components/workspace/TimelineView.test.tsx@@ -667,6 +667,51 @@ describe("editing commands", () => {});describe("the transport and the playhead", () => {+ it("moves the playhead on playback ticks before React commits, and keeps paused seeks and zoom aligned", () => {+ const frames = new Map<number, FrameRequestCallback>();+ let nextId = 0;+ let now = 0;+ vi.spyOn(performance, "now").mockImplementation(() => now);+ vi.stubGlobal("requestAnimationFrame", (callback: FrameRequestCallback) => { frames.set(++nextId, callback); return nextId; });+ vi.stubGlobal("cancelAnimationFrame", (id: number) => frames.delete(id));+ vi.spyOn(HTMLElement.prototype, "clientWidth", "get").mockImplementation(function (this: HTMLElement) {+ return this.classList.contains("timeline-grid-scroll") ? 1180 : 0;+ });+ try {+ const { container } = render_(withClip(measuredVideo(projectWithMedia(), 40_000), {}));+ const marker = container.querySelector<HTMLElement>(".timeline-playhead")!;+ expect(marker.style.transform).toBe("translateX(0px)");+ fireEvent.click(screen.getByRole("button", { name: "Play" }));+ const advance = (ms: number, expectedOffset: number) => act(() => {+ now += ms;+ const callbacks = [...frames.values()];+ frames.clear();+ callbacks.forEach((callback) => callback(now));+ // Inside act, React has not committed the scheduled state update yet.+ expect(marker.style.transform).toBe(`translateX(${expectedOffset}px)`);+ });+ advance(1000, 25);+ expect(toolbarTime(container)).toBe("00:00:01:00");+ advance(1000, 50);+ expect(screen.getByRole("button", { name: "Pause" })).not.toBeNull();+ fireEvent.click(screen.getByRole("button", { name: "Pause" }));+ advance(1000, 50);+ press(container, "ArrowRight", { shiftKey: true });+ expect(marker.style.transform).toBe("translateX(75px)");+ press(container, "=");+ expect(marker.style.transform).toBe("translateX(93.75px)");+ press(container, "j");+ advance(1000, 62.5);+ press(container, "k");+ press(container, "Home");+ expect(marker.style.transform).toBe("translateX(0px)");+ } finally {+ cleanup();+ vi.restoreAllMocks();+ vi.unstubAllGlobals();+ }+ });+it("is five flat controls in the NLE order, off with a reason when there is nothing to play", () => {const empty = createProjectConfig({ name: "Ceramic lamp", prompt: "A quiet product film", aspectRatio: "16:9", resolution: "1080p", targetDurationSeconds: 30 });const { container, rerender } = render_(empty);diff --git a/src/components/workspace/TimelineView.tsx b/src/components/workspace/TimelineView.tsxindex 04897e1..b2b1d50 100644--- a/src/components/workspace/TimelineView.tsx+++ b/src/components/workspace/TimelineView.tsx@@ -233,6 +233,7 @@ export function TimelineView({ config, folderPath, generationCompletionTimes = {const viewRef = useRef<HTMLDivElement>(null);const scrollRef = useRef<HTMLDivElement>(null);const rulerRef = useRef<HTMLDivElement>(null);+ const playheadMarkerRef = useRef<HTMLDivElement>(null);const clipNameRef = useRef<HTMLInputElement>(null);const [importing, setImporting] = useState(false);const [importError, setImportError] = useState<string | null>(null);@@ -384,11 +385,20 @@ export function TimelineView({ config, folderPath, generationCompletionTimes = {useEffect(() => { if (clipCount === 0 && playing) setPlaying(false); }, [clipCount, playing]);- /* The playhead is driven by the program monitor's monotonic animation clock- while playing. These two are handed down rather than declared inline- because the monitor's animation loop depends on their identity: a new- closure per render would tear its clock down sixty times a second. */- const seek = useCallback((ms: number) => setPlayhead(ms), []);+ /* Paint on the monitor's animation tick, before React schedules the larger+ editor update. Native video keeps playing while that update is pending. */+ const paintPlayhead = useCallback((ms: number) => {+ const marker = playheadMarkerRef.current;+ if (!marker) return;+ const ratio = Math.max(0, Math.min(1, ms / duration));+ marker.style.transform = `translateX(${ratio * (lanePx ?? rulerRef.current?.clientWidth ?? 0)}px)`;+ }, [duration, lanePx]);+ const seek = useCallback((ms: number) => {+ paintPlayhead(ms);+ setPlayhead(ms);+ }, [paintPlayhead]);+ // Paused seeks, zoom and resizing use the same positioning as playback.+ useLayoutEffect(() => paintPlayhead(playhead), [paintPlayhead, playhead]);const setPlayingFromMonitor = useCallback((value: boolean) => { setPlaying(value); if (!value) setRate(1); }, []);// Another clip, another length: what was being typed belonged to the old one.@@ -1138,7 +1148,6 @@ export function TimelineView({ config, folderPath, generationCompletionTimes = {const onRulerPointerDown = useCallback((event: React.PointerEvent<HTMLElement>) => rulerHandlers.current.beginScrub(event), []);const onRulerMenu = useCallback((event: React.MouseEvent<HTMLElement>) => rulerHandlers.current.rulerMenu(event), []);- const playheadRatio = Math.max(0, Math.min(1, playhead / duration));const playheadTimecode = formatTimecode(playhead, fps);const framesAt = playheadTimecode.lastIndexOf(":");const panelsClass = `edit-panels${sourcesOpen ? "" : " edit-panels--no-sources"}${inspectorOpen ? "" : " edit-panels--no-inspector"}`;@@ -1553,7 +1562,7 @@ export function TimelineView({ config, folderPath, generationCompletionTimes = {{/* The playhead: a pentagon head in the ruler that can be dragged,and a line through every track. While it is being dragged itcarries a flag with the time it is at. */}- <div className="timeline-playhead" style={{ left: `calc(var(--track-column) + (100% - var(--track-column)) * ${playheadRatio})` }}>+ <div ref={playheadMarkerRef} className="timeline-playhead"><span className="timeline-playhead__head" onPointerDown={beginScrub} aria-hidden="true" />{scrubbing && <span className="timeline-playhead__flag" aria-hidden="true">{formatTimecode(playhead, fps)}</span>}</div>diff --git a/src/styles/timeline.css b/src/styles/timeline.cssindex 9ec32d6..dfae7cd 100644--- a/src/styles/timeline.css+++ b/src/styles/timeline.css@@ -1638,6 +1638,9 @@ button.transport-time:hover { background: var(--fill-subtle-hover); }.timeline-playhead {position: absolute;+ left: var(--track-column);+ /* Composite movement independently of the playing video and track paint. */+ will-change: transform;z-index: 9;top: 0;bottom: 0;