Fix live sizes

This commit is contained in:
Nick Mowen 2022-10-22 07:25:54 -06:00
parent fa5bb61700
commit e39cb5e2f4

View File

@ -25,8 +25,8 @@ export default function Camera({ camera }) {
const [viewMode, setViewMode] = useState('live'); const [viewMode, setViewMode] = useState('live');
const cameraConfig = config?.cameras[camera]; const cameraConfig = config?.cameras[camera];
const liveWidth = cameraConfig const jsmpegWidth = cameraConfig
? Math.round(cameraConfig.live.height * (cameraConfig.detect.width / cameraConfig.detect.height)) ? Math.round(cameraConfig.restream.jsmpeg.height * (cameraConfig.detect.width / cameraConfig.detect.height))
: 0; : 0;
const [viewSource, setViewSource] = usePersistence(`${camera}-source`, 'webrtc'); const [viewSource, setViewSource] = usePersistence(`${camera}-source`, 'webrtc');
const [options, setOptions] = usePersistence(`${camera}-feed`, emptyObject); const [options, setOptions] = usePersistence(`${camera}-feed`, emptyObject);
@ -124,7 +124,7 @@ export default function Camera({ camera }) {
player = ( player = (
<Fragment> <Fragment>
<div> <div>
<WebRtcPlayer camera={camera} width={liveWidth} height={cameraConfig.live.height} /> <WebRtcPlayer camera={camera} width={jsmpegWidth} height={cameraConfig.restream.jsmpeg.height} />
</div> </div>
</Fragment> </Fragment>
) )
@ -132,7 +132,7 @@ export default function Camera({ camera }) {
player = ( player = (
<Fragment> <Fragment>
<div> <div>
<JSMpegPlayer camera={camera} width={liveWidth} height={cameraConfig.live.height} /> <JSMpegPlayer camera={camera} width={jsmpegWidth} height={cameraConfig.restream.jsmpeg.height} />
</div> </div>
</Fragment> </Fragment>
); );