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

Let an animatic clip take its first seek right after page load

Claudeb26976b9ab22
diff --git a/client/src/components/musicVideo/StoryboardAnimatic.jsx b/client/src/components/musicVideo/StoryboardAnimatic.jsx
index a99b8b307b..18f31a6662 100644
--- a/client/src/components/musicVideo/StoryboardAnimatic.jsx
+++ b/client/src/components/musicVideo/StoryboardAnimatic.jsx
@@ -237,7 +237,8 @@ function ShotClip({ scene, audioRef, time, current, preload = 'auto' }) {
const videoRef = useRef(null);
const [ready, setReady] = useState(false);
const [reload, setReload] = useState(0);
- const recovery = useRef({ errors: 0, timer: 0, lastSeekAt: 0, lastReloadAt: 0 });
+ // -Infinity: no seek or restart yet, so the first one is never held back.
+ const recovery = useRef({ errors: 0, timer: 0, lastSeekAt: -Infinity, lastReloadAt: -Infinity });
const file = useVideoFileSrc(scene.videoHistoryId);
const src = file.src || (file.resolving ? null : `/data/videos/${scene.videoHistoryId}.mp4`);
const sync = useCallback(() => {
diff --git a/client/src/components/musicVideo/StoryboardAnimatic.test.jsx b/client/src/components/musicVideo/StoryboardAnimatic.test.jsx
index 2a6c2d7a40..0c3a3387c3 100644
--- a/client/src/components/musicVideo/StoryboardAnimatic.test.jsx
+++ b/client/src/components/musicVideo/StoryboardAnimatic.test.jsx
@@ -182,6 +182,8 @@ describe('StoryboardAnimatic clips', () => {
// Uniquely catches a slow link stuck re-seeking: each seek restarts the download, so a clip chased every time update never plays.
it('lets a playing clip fetch after a seek before moving it again', async () => {
+ // Just after page load: the clip's first seek must not wait on a seek that never happened.
+ const now = vi.spyOn(performance, 'now').mockReturnValue(100);
render(<StoryboardAnimatic project={{ id: 'p', scenes: clipScenes }} audioUrl="/song.mp3" />);
const clip = await screen.findByLabelText('Clip for Opening');
await waitFor(() => expect(clip.getAttribute('src')).toBe('/data/videos/clip-a.mov'));
@@ -200,6 +202,7 @@ describe('StoryboardAnimatic clips', () => {
Object.defineProperty(clip, 'readyState', { value: 4, configurable: true });
fireEvent.seeked(clip);
expect(clip.currentTime).toBeCloseTo(4, 6);
+ now.mockRestore();
});
it('steps a paused clip to each frame while it is still fetching', async () => {