motion video controls handle current time better

This commit is contained in:
Nicolas Mowen 2024-05-01 10:24:21 -06:00
parent 2e63941598
commit aea4e77d69

View File

@ -805,6 +805,11 @@ function MotionReview({
return;
}
if (nextTimestamp >= timeRange.before - 4) {
setPlaying(false);
return;
}
const handleTimeout = () => {
setCurrentTime(nextTimestamp);
timeoutIdRef.current = setTimeout(handleTimeout, 500 / playbackRate);
@ -818,7 +823,7 @@ function MotionReview({
}
};
}
}, [playing, playbackRate, nextTimestamp]);
}, [playing, playbackRate, nextTimestamp, setPlaying, timeRange]);
const { alignStartDateToTimeline } = useTimelineUtils({
segmentDuration,
@ -962,7 +967,6 @@ function MotionReview({
)}
</div>
{!scrubbing && (
<VideoControls
className="absolute bottom-16 left-1/2 -translate-x-1/2 bg-secondary"
features={{
@ -971,6 +975,7 @@ function MotionReview({
playbackRate: true,
}}
isPlaying={playing}
show={!scrubbing}
playbackRates={[4, 8, 12, 16]}
playbackRate={playbackRate}
controlsOpen={controlsOpen}
@ -990,9 +995,7 @@ function MotionReview({
}
}}
onSetPlaybackRate={setPlaybackRate}
show={currentTime < timeRange.before - 4}
/>
)}
</>
);
}