mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-20 03:47:38 +00:00
fix(studio): guard against inverted in/out work-area points in loop ticks
If the user sets out-point before in-point (outPoint < inPoint), rawLoopStart >= rawLoopEnd caused the loop guard to fire immediately on every tick, creating a tight infinite seek loop. Both the forward RAF tick and the reverse RAF tick now fall back to the full composition range when the work area is invalid.
This commit is contained in:
@@ -186,8 +186,10 @@ export function useTimelinePlayer() {
|
||||
const dur = adapter.getDuration();
|
||||
liveTime.notify(time); // direct DOM updates, no React re-render
|
||||
const { inPoint, outPoint } = usePlayerStore.getState();
|
||||
const loopEnd = outPoint !== null ? outPoint : dur;
|
||||
const loopStart = inPoint !== null ? inPoint : 0;
|
||||
const rawLoopEnd = outPoint !== null ? outPoint : dur;
|
||||
const rawLoopStart = inPoint !== null ? inPoint : 0;
|
||||
const loopEnd = rawLoopStart < rawLoopEnd ? rawLoopEnd : dur;
|
||||
const loopStart = rawLoopStart < rawLoopEnd ? rawLoopStart : 0;
|
||||
if (time >= loopEnd && !adapter.isPlaying()) {
|
||||
if (usePlayerStore.getState().loopEnabled && dur > 0) {
|
||||
adapter.seek(loopStart);
|
||||
@@ -273,8 +275,10 @@ export function useTimelinePlayer() {
|
||||
const elapsed = ((now - startedAt) / 1000) * speed;
|
||||
let nextTime = startTime - elapsed;
|
||||
const { inPoint, outPoint } = usePlayerStore.getState();
|
||||
const loopEnd = outPoint !== null ? outPoint : duration;
|
||||
const loopStart = inPoint !== null ? inPoint : 0;
|
||||
const rawLoopEnd = outPoint !== null ? outPoint : duration;
|
||||
const rawLoopStart = inPoint !== null ? inPoint : 0;
|
||||
const loopEnd = rawLoopStart < rawLoopEnd ? rawLoopEnd : duration;
|
||||
const loopStart = rawLoopStart < rawLoopEnd ? rawLoopStart : 0;
|
||||
if (nextTime <= loopStart) {
|
||||
if (usePlayerStore.getState().loopEnabled && duration > 0) {
|
||||
startTime = loopEnd;
|
||||
|
||||
Reference in New Issue
Block a user