Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

Animatic frame steps show the exact clip frame (#11227)

[._.]/4e3f9488f55e
diff --git a/client/src/components/musicVideo/StoryboardAnimatic.jsx b/client/src/components/musicVideo/StoryboardAnimatic.jsx
index a48de42fb7..f405d3b608 100644
--- a/client/src/components/musicVideo/StoryboardAnimatic.jsx
+++ b/client/src/components/musicVideo/StoryboardAnimatic.jsx
@@ -145,8 +145,11 @@ function useLyricOverlay({ project, enabled, audioRef, time }) {
};
}
-// How far a shot's clip may drift from the song before it is put back in step.
+// How far a playing shot's clip may drift from the song before it is put back in step.
+// Paused (frame stepping, scrubbing), the clip must show the exact frame, so any gap
+// wider than a fraction of a frame re-seeks it.
const CLIP_DRIFT_SEC = 0.25;
+const CLIP_PAUSED_DRIFT_SEC = 0.01;
/**
* Where song time `t` lands in a shot's clip: the take's edit-in point (a
@@ -188,7 +191,8 @@ function ShotClip({ scene, audioRef, time, current }) {
if (!video || !audio || video.readyState < 1) return;
const duration = Number.isFinite(video.duration) ? video.duration : null;
const target = clipTimeAt(scene, current ? audio.currentTime || 0 : scene.startSec || 0, duration);
- if (Math.abs((video.currentTime || 0) - target) > CLIP_DRIFT_SEC) video.currentTime = target;
+ const tolerance = current && audio.paused ? CLIP_PAUSED_DRIFT_SEC : CLIP_DRIFT_SEC;
+ if (Math.abs((video.currentTime || 0) - target) > tolerance) video.currentTime = target;
if (!current || audio.paused) video.pause?.();
else if (video.paused) video.play?.()?.catch?.(() => {});
}, [scene, audioRef, current]);
diff --git a/client/src/components/musicVideo/StoryboardAnimatic.test.jsx b/client/src/components/musicVideo/StoryboardAnimatic.test.jsx
index 2f99c685b7..9c9d2ad4c6 100644
--- a/client/src/components/musicVideo/StoryboardAnimatic.test.jsx
+++ b/client/src/components/musicVideo/StoryboardAnimatic.test.jsx
@@ -149,6 +149,17 @@ describe('StoryboardAnimatic clips', () => {
expect(uploadGalleryImage.mock.lastCall[0]).toBe(clip);
});
+ it('moves a paused clip to the exact frame on each frame step', async () => {
+ render(<StoryboardAnimatic project={{ id: 'p', scenes: clipScenes }} audioUrl="/song.mp3" />);
+ const clip = await screen.findByLabelText('Clip for Opening');
+ Object.defineProperty(clip, 'readyState', { value: 4, configurable: true });
+ Object.defineProperty(clip, 'duration', { value: 10, configurable: true });
+ fireEvent.click(screen.getByRole('button', { name: 'Forward 1 frame' }));
+ expect(clip.currentTime).toBeCloseTo(1.5 / 24);
+ fireEvent.click(screen.getByRole('button', { name: 'Forward 1 frame' }));
+ expect(clip.currentTime).toBeCloseTo(2.5 / 24);
+ });
+
it('maps song time into the clip: trimmed in-point, then loop or hold past its end', () => {
const performance = {
sceneId: 'p', startSec: 10, endSec: 20, shotMode: 'performance', videoHistoryId: 'v1',