Fix seeking

This commit is contained in:
Nicolas Mowen 2024-03-22 09:59:05 -06:00
parent 6f86fe13ed
commit db40177868
3 changed files with 12 additions and 2 deletions

View File

@ -353,7 +353,7 @@ function PreviewFramesPlayer({
return previewFrames.map((frame) =>
// @ts-expect-error we know this item will exist
parseFloat(frame.split("-").slice(undefined, -5)),
parseFloat(frame.split("-").at(-1).slice(undefined, -5)),
);
}, [previewFrames]);

View File

@ -500,7 +500,7 @@ function VideoPreview({
</video>
<Slider
ref={sliderRef}
className="absolute inset-x-0 bottom-0 z-30 pointer-events-none"
className="absolute inset-x-0 bottom-0 z-30"
value={[progress]}
onValueChange={onManualSeek}
onValueCommit={onStopManualSeek}

View File

@ -811,7 +811,17 @@ function MotionReview({
isPlaying={playing}
onPlayPause={setPlaying}
onSeek={(diff) => {
const wasPlaying = playing;
if (wasPlaying) {
setPlaying(false);
}
setCurrentTime(currentTime + diff);
if (wasPlaying) {
setTimeout(() => setPlaying(true), 100);
}
}}
show={currentTime < timeRange.before - 4}
/>