diff --git a/web/src/routes/Birdseye.jsx b/web/src/routes/Birdseye.jsx index 4ed800437..b43c3b137 100644 --- a/web/src/routes/Birdseye.jsx +++ b/web/src/routes/Birdseye.jsx @@ -6,7 +6,7 @@ import Heading from '../components/Heading'; import WebRtcPlayer from '../components/WebRtcPlayer'; import '../components/MsePlayer'; import useSWR from 'swr'; -import { useMemo } from 'preact/hooks'; +import { useMemo, useState } from 'preact/hooks'; import CameraControlPanel from '../components/CameraControlPanel'; import { baseUrl } from '../api/baseUrl'; @@ -26,16 +26,19 @@ export default function Birdseye() { .map(([_, camera]) => camera.name); }, [config]); + const [isMaxWidth, setIsMaxWidth] = useState(false); + if (!config || !sourceIsLoaded) { return ; } let player; + const playerClass = isMaxWidth ? 'max-w-5xl xl:w-1/2' : 'w-full'; if (viewSource == 'mse' && config.birdseye.restream) { if ('MediaSource' in window) { player = ( -
+
); } - } else if (viewSource == 'webrtc' && config.birdseye.restream) { + } else if (viewSource == 'webrtc' ) { player = ( -
+
@@ -63,7 +66,7 @@ export default function Birdseye() { } else { player = ( -
+
@@ -77,26 +80,37 @@ export default function Birdseye() { Birdseye + + {config.birdseye.restream && ( )}
- {player} +
{/* Use dynamic class */} + {player} +
{ptzCameras.length ? ( -
+
Control Panel {ptzCameras.map((camera) => (