* Hide motion playback controls during scrubbing

* Fix portrait recordings on mobile

* Don't apply to desktop
This commit is contained in:
Nicolas Mowen 2024-04-05 07:38:05 -06:00 committed by GitHub
parent fb7cfe5471
commit 2318e79502
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 31 additions and 27 deletions

View File

@ -92,7 +92,7 @@ export default function HlsVideoPlayer({
return (
<TransformWrapper minScale={1.0}>
<div
className={`relative w-full ${className ?? ""} ${visible ? "visible" : "hidden"}`}
className={`relative ${className ?? ""} ${visible ? "visible" : "hidden"}`}
onMouseOver={
isDesktop
? () => {
@ -112,9 +112,11 @@ export default function HlsVideoPlayer({
<TransformComponent
wrapperStyle={{
width: "100%",
height: "100%",
}}
contentStyle={{
width: "100%",
height: isMobile ? "100%" : undefined,
}}
>
<video

View File

@ -898,35 +898,37 @@ function MotionReview({
)}
</div>
<VideoControls
className="absolute bottom-16 left-1/2 -translate-x-1/2"
features={{
volume: false,
seek: true,
playbackRate: true,
}}
isPlaying={playing}
playbackRates={[4, 8, 12, 16]}
playbackRate={playbackRate}
controlsOpen={controlsOpen}
setControlsOpen={setControlsOpen}
onPlayPause={setPlaying}
onSeek={(diff) => {
const wasPlaying = playing;
{!scrubbing && (
<VideoControls
className="absolute bottom-16 left-1/2 -translate-x-1/2"
features={{
volume: false,
seek: true,
playbackRate: true,
}}
isPlaying={playing}
playbackRates={[4, 8, 12, 16]}
playbackRate={playbackRate}
controlsOpen={controlsOpen}
setControlsOpen={setControlsOpen}
onPlayPause={setPlaying}
onSeek={(diff) => {
const wasPlaying = playing;
if (wasPlaying) {
setPlaying(false);
}
if (wasPlaying) {
setPlaying(false);
}
setCurrentTime(currentTime + diff);
setCurrentTime(currentTime + diff);
if (wasPlaying) {
setTimeout(() => setPlaying(true), 100);
}
}}
onSetPlaybackRate={setPlaybackRate}
show={currentTime < timeRange.before - 4}
/>
if (wasPlaying) {
setTimeout(() => setPlaying(true), 100);
}
}}
onSetPlaybackRate={setPlaybackRate}
show={currentTime < timeRange.before - 4}
/>
)}
</>
);
}