Simplify recordings view

This commit is contained in:
Nicolas Mowen 2024-04-10 07:26:28 -06:00
parent ca8e3ad3b5
commit 8d8a07c02a
2 changed files with 103 additions and 104 deletions

View File

@ -19,7 +19,6 @@ const unsupportedErrorCodes = [
]; ];
type HlsVideoPlayerProps = { type HlsVideoPlayerProps = {
className: string;
children?: ReactNode; children?: ReactNode;
videoRef: MutableRefObject<HTMLVideoElement | null>; videoRef: MutableRefObject<HTMLVideoElement | null>;
visible: boolean; visible: boolean;
@ -31,7 +30,6 @@ type HlsVideoPlayerProps = {
onPlaying?: () => void; onPlaying?: () => void;
}; };
export default function HlsVideoPlayer({ export default function HlsVideoPlayer({
className,
children, children,
videoRef, videoRef,
visible, visible,
@ -91,26 +89,10 @@ export default function HlsVideoPlayer({
return ( return (
<TransformWrapper minScale={1.0}> <TransformWrapper minScale={1.0}>
<div
className={`relative ${className ?? ""} ${visible ? "visible" : "hidden"}`}
onMouseOver={
isDesktop
? () => {
setControls(true);
}
: undefined
}
onMouseOut={
isDesktop
? () => {
setControls(controlsOpen);
}
: undefined
}
onClick={isDesktop ? undefined : () => setControls(!controls)}
>
<TransformComponent <TransformComponent
wrapperStyle={{ wrapperStyle={{
position: "relative",
display: visible ? undefined : "none",
width: "100%", width: "100%",
height: "100%", height: "100%",
}} }}
@ -132,9 +114,7 @@ export default function HlsVideoPlayer({
if (isMobile) { if (isMobile) {
setControls(true); setControls(true);
setMobileCtrlTimeout( setMobileCtrlTimeout(setTimeout(() => setControls(false), 4000));
setTimeout(() => setControls(false), 4000),
);
} }
}} }}
onPlaying={onPlaying} onPlaying={onPlaying}
@ -165,7 +145,25 @@ export default function HlsVideoPlayer({
} }
}} }}
/> />
</TransformComponent> <div
className="absolute inset-0"
onMouseOver={
isDesktop
? () => {
setControls(true);
}
: undefined
}
onMouseOut={
isDesktop
? () => {
setControls(controlsOpen);
}
: undefined
}
onClick={isDesktop ? undefined : () => setControls(!controls)}
>
<div className={`size-full relative ${visible ? "" : "hidden"}`}>
<VideoControls <VideoControls
className="absolute bottom-5 left-1/2 -translate-x-1/2" className="absolute bottom-5 left-1/2 -translate-x-1/2"
video={videoRef.current} video={videoRef.current}
@ -201,6 +199,8 @@ export default function HlsVideoPlayer({
/> />
{children} {children}
</div> </div>
</div>
</TransformComponent>
</TransformWrapper> </TransformWrapper>
); );
} }

View File

@ -150,7 +150,6 @@ export default function DynamicVideoPlayer({
return ( return (
<> <>
<HlsVideoPlayer <HlsVideoPlayer
className={className ?? ""}
videoRef={playerRef} videoRef={playerRef}
visible={!(isScrubbing || isLoading)} visible={!(isScrubbing || isLoading)}
currentSource={source} currentSource={source}