mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 04:38:33 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user