Skip to content

Commit d2f2fb0

Browse files
committed
chore: fix looped video preview seeking
1 parent 8f5a8b4 commit d2f2fb0

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

packages/webui/src/client/lib/ui/videoPreviewScrub.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ export function setVideoElementPosition(
77
): void {
88
let targetTime = timePosition + seek
99
if (loop && vEl.duration > 0) {
10-
targetTime =
11-
targetTime % ((itemDuration > 0 ? Math.min(vEl.duration * 1000, itemDuration) : vEl.duration * 1000) * 1000)
10+
const loopWindowMs = itemDuration > 0 ? Math.min(vEl.duration * 1000, itemDuration) : vEl.duration * 1000
11+
targetTime = ((targetTime % loopWindowMs) + loopWindowMs) % loopWindowMs
1212
} else if (itemDuration > 0) {
13-
targetTime = Math.min(targetTime, itemDuration)
13+
targetTime = Math.max(0, Math.min(targetTime, itemDuration))
1414
}
1515
vEl.currentTime = targetTime / 1000
1616
}

0 commit comments

Comments
 (0)