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.
This commit is contained in:
Miguel Ángel
2026-05-18 17:28:45 -04:00
parent f66c47c812
commit 1a4e534d0f
@@ -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