From 1a4e534d0fdbe128f7d9b81cfc24540f189a3090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel?= Date: Mon, 18 May 2026 17:28:45 -0400 Subject: [PATCH] fix(studio): uncap seek clamp to include timeline element range The seek function clamped to adapter.getDuration() which only knows the root composition's authored duration. Appended timeline elements extend beyond this range. Compute the effective max from both the adapter duration and the store's element boundaries so scrubbing reaches the full timeline. --- packages/studio/src/player/hooks/useTimelinePlayer.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/studio/src/player/hooks/useTimelinePlayer.ts b/packages/studio/src/player/hooks/useTimelinePlayer.ts index 7b6579afe..cecd98458 100644 --- a/packages/studio/src/player/hooks/useTimelinePlayer.ts +++ b/packages/studio/src/player/hooks/useTimelinePlayer.ts @@ -357,7 +357,13 @@ export function useTimelinePlayer() { pendingSeekRef.current = Math.max(0, time); return false; } - const duration = Math.max(0, adapter.getDuration()); + const adapterDur = adapter.getDuration(); + const state = usePlayerStore.getState(); + const maxEnd = + state.elements.length > 0 + ? Math.max(...state.elements.map((el) => el.start + el.duration)) + : 0; + const duration = Math.max(0, adapterDur, maxEnd); const nextTime = Math.max(0, duration > 0 ? Math.min(duration, time) : time); adapter.seek(nextTime, options); liveTime.notify(nextTime); // Direct DOM updates (playhead, timecode, progress) — no re-render