diff --git a/web/src/components/player/HlsVideoPlayer.tsx b/web/src/components/player/HlsVideoPlayer.tsx index 4492bae43..fd0e79db0 100644 --- a/web/src/components/player/HlsVideoPlayer.tsx +++ b/web/src/components/player/HlsVideoPlayer.tsx @@ -59,6 +59,7 @@ export default function HlsVideoPlayer({ const hlsRef = useRef(); const [useHlsCompat, setUseHlsCompat] = useState(false); + const [loadedMetadata, setLoadedMetadata] = useState(false); useEffect(() => { if (!videoRef.current) { @@ -153,7 +154,7 @@ export default function HlsVideoPlayer({ return (
{ @@ -174,7 +175,7 @@ export default function HlsVideoPlayer({ {!loaded && } {cameraPreviews && !currentPreview && ( -
+
No Preview Found
)} diff --git a/web/src/components/player/dynamic/DynamicVideoPlayer.tsx b/web/src/components/player/dynamic/DynamicVideoPlayer.tsx index 3c656a4a7..c869e516d 100644 --- a/web/src/components/player/dynamic/DynamicVideoPlayer.tsx +++ b/web/src/components/player/dynamic/DynamicVideoPlayer.tsx @@ -38,16 +38,23 @@ export default function DynamicVideoPlayer({ const { data: config } = useSWR("config"); // playback behavior - const wideVideo = useMemo(() => { + + const grow = useMemo(() => { if (!config) { - return false; + return "aspect-video"; } - return ( + const aspectRatio = config.cameras[camera].detect.width / - config.cameras[camera].detect.height > - 1.7 - ); + config.cameras[camera].detect.height; + + if (aspectRatio > 2) { + return ""; + } else if (aspectRatio < 16 / 9) { + return "aspect-tall"; + } else { + return "aspect-video"; + } }, [camera, config]); // controlling playback @@ -163,7 +170,7 @@ export default function DynamicVideoPlayer({ className={`w-full relative ${isScrubbing || isLoading ? "hidden" : "visible"}`} >
("config"); + // filters const [selectedCameras, setSelectedCameras] = useState(); @@ -45,6 +47,24 @@ export default function SubmitPlus() { ]); const [upload, setUpload] = useState(); + const grow = useMemo(() => { + if (!config || !upload) { + return ""; + } + + const camera = config.cameras[upload.camera]; + + if (!camera) { + return ""; + } + + if (camera.detect.width / camera.detect.height < 16 / 9) { + return "aspect-video object-contain"; + } + + return ""; + }, [config, upload]); + const onSubmitToPlus = useCallback( async (falsePositive: boolean) => { if (!upload) { @@ -102,7 +122,7 @@ export default function SubmitPlus() { {`${upload?.label}`} diff --git a/web/src/views/events/RecordingView.tsx b/web/src/views/events/RecordingView.tsx index 60b8e58a8..d7220c7ab 100644 --- a/web/src/views/events/RecordingView.tsx +++ b/web/src/views/events/RecordingView.tsx @@ -170,21 +170,34 @@ export function DesktopRecordingView({ : null, ); - const grow = useMemo(() => { + const mainCameraAspect = useMemo(() => { if (!config) { - return "aspect-video"; + return "normal"; } const aspectRatio = config.cameras[mainCamera].detect.width / config.cameras[mainCamera].detect.height; + if (aspectRatio > 2) { - return "aspect-wide"; + return "wide"; + } else if (aspectRatio < 16 / 9) { + return "tall"; } else { - return "aspect-video"; + return "normal"; } }, [config, mainCamera]); + const grow = useMemo(() => { + if (mainCameraAspect == "wide") { + return "w-full aspect-wide"; + } else if (mainCameraAspect == "tall") { + return "h-full aspect-tall"; + } else { + return "w-full aspect-video"; + } + }, [mainCameraAspect]); + return (