diff --git a/web/src/routes/Birdseye.jsx b/web/src/routes/Birdseye.jsx index feaf6ff0e..91c97fcb9 100644 --- a/web/src/routes/Birdseye.jsx +++ b/web/src/routes/Birdseye.jsx @@ -10,7 +10,10 @@ import useSWR from 'swr'; export default function Birdseye() { const { data: config } = useSWR('config'); - const [viewSource, setViewSource, sourceIsLoaded] = usePersistence('birdseye-source', 'mse'); + const [viewSource, setViewSource, sourceIsLoaded] = usePersistence( + 'birdseye-source', + getDefaultLiveMode(config) + ); const sourceValues = ['mse', 'webrtc', 'jsmpeg']; if (!config || !sourceIsLoaded) { @@ -80,3 +83,16 @@ export default function Birdseye() { ); } + + +function getDefaultLiveMode(config) { + if (config) { + if (config.birdseye.restream) { + return config.ui.live_mode; + } + + return 'jsmpeg'; + } + + return undefined; +} diff --git a/web/src/routes/Camera.jsx b/web/src/routes/Camera.jsx index e99aa7db5..7a50d530a 100644 --- a/web/src/routes/Camera.jsx +++ b/web/src/routes/Camera.jsx @@ -32,7 +32,7 @@ export default function Camera({ camera }) { : 0; const [viewSource, setViewSource, sourceIsLoaded] = usePersistence( `${camera}-source`, - getDefaultLiveMode(config, cameraConfig) + getDefaultLiveMode(config, cameraConfig, restreamEnabled) ); const sourceValues = restreamEnabled ? ['mse', 'webrtc', 'jsmpeg'] : ['jsmpeg']; const [options, setOptions] = usePersistence(`${camera}-feed`, emptyObject);