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

fix: preserve frame-step targets when pausing document previews

Adam Eivyec8635b38e47
diff --git a/client/src/components/musicVideo/CompositionPreviewPlayer.jsx b/client/src/components/musicVideo/CompositionPreviewPlayer.jsx
index d63b73ce49..4a5dff3009 100644
--- a/client/src/components/musicVideo/CompositionPreviewPlayer.jsx
+++ b/client/src/components/musicVideo/CompositionPreviewPlayer.jsx
@@ -73,7 +73,8 @@ export default function CompositionPreviewPlayer({ project, audioUrl, seekReques
const next = Math.min(Math.max(0, time), Math.max(0, duration - 1 / fps));
setT(next);
preview.seek(next);
- if (audioRef.current && Math.abs((audioRef.current.currentTime || 0) - next) > 0.05) audioRef.current.currentTime = next;
+ // Even a one-frame move must update audio before the pause repaint reads it.
+ if (audioRef.current && audioRef.current.currentTime !== next) audioRef.current.currentTime = next;
}, [duration, fps, preview.seek]);
useEffect(() => {
diff --git a/client/src/components/musicVideo/CompositionPreviewPlayer.test.jsx b/client/src/components/musicVideo/CompositionPreviewPlayer.test.jsx
index 4377060a63..9d02750022 100644
--- a/client/src/components/musicVideo/CompositionPreviewPlayer.test.jsx
+++ b/client/src/components/musicVideo/CompositionPreviewPlayer.test.jsx
@@ -62,6 +62,25 @@ beforeEach(() => {
});
describe('CompositionPreviewPlayer', () => {
+ it('preserves a one-frame step while pausing playback with audio present', async () => {
+ const play = vi.spyOn(HTMLMediaElement.prototype, 'play').mockResolvedValue();
+ const pause = vi.spyOn(HTMLMediaElement.prototype, 'pause').mockImplementation(() => {});
+ const raf = vi.spyOn(window, 'requestAnimationFrame').mockImplementation(() => 1);
+ const cancel = vi.spyOn(window, 'cancelAnimationFrame').mockImplementation(() => {});
+ try {
+ const { container } = render(<CompositionPreviewPlayer project={project} audioUrl='/song.mp3' shotNav />);
+ await waitFor(() => expect(screen.getByRole('button', { name: 'Play' })).toBeEnabled());
+ fireEvent.click(screen.getByRole('button', { name: 'Play' }));
+ container.querySelector('audio').currentTime = 48.5 / 24;
+ act(() => raf.mock.calls.at(-1)[0]());
+ fireEvent.click(screen.getByRole('button', { name: 'Forward 1 frame' }));
+ const next = 49.5 / 24;
+ expect(screen.getByRole('button', { name: 'Play' })).toBeEnabled();
+ expect(container.querySelector('audio').currentTime).toBeCloseTo(next);
+ expect(socket.emit).toHaveBeenLastCalledWith('generated-preview:seek', expect.objectContaining({ t: next, playing: false }));
+ } finally { play.mockRestore(); pause.mockRestore(); raf.mockRestore(); cancel.mockRestore(); }
+ });
+
it('sends motion mode during playback and exact mode on pause and scrub without reopening', async () => {
const play = vi.spyOn(HTMLMediaElement.prototype, 'play').mockResolvedValue();
const pause = vi.spyOn(HTMLMediaElement.prototype, 'pause').mockImplementation(() => {});
diff --git a/server/services/musicVideo/render.terminal.test.js b/server/services/musicVideo/render.terminal.test.js
index a43fe5868d..3c1c515292 100644
--- a/server/services/musicVideo/render.terminal.test.js
+++ b/server/services/musicVideo/render.terminal.test.js
@@ -639,7 +639,7 @@ describe('film look finishing pass on a footage render', () => {
// The encode's end is the middle of the bar; the pass fills the rest.
expect(broadcastSse).toHaveBeenCalledWith(expect.anything(), { type: 'progress', progress: 0.5 });
expect(look.calls).toHaveLength(1);
- expect(look.calls[0]).toMatchObject({ jobId, path: expect.stringMatching(/^\/data\/videos\/music-video-/), project: expect.objectContaining({ id: pid }) });
+ expect(look.calls[0]).toMatchObject({ jobId, path: lastProc().args.at(-1), project: expect.objectContaining({ id: pid }) });
expect(getRenderJobStatus(jobId).status).toBe('running');
expect(updateProject).not.toHaveBeenCalledWith(pid, expect.objectContaining({ status: 'complete' }));
look.calls[0].onProgress(0.5);