Fix Webui Default Stream (#5455)

* Pass restream enabled

* Use livemode for birdseye as well
This commit is contained in:
Nicolas Mowen 2023-02-12 06:36:36 -07:00 committed by GitHub
parent c74c9ff161
commit 3d90366af2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View File

@ -10,7 +10,10 @@ import useSWR from 'swr';
export default function Birdseye() { export default function Birdseye() {
const { data: config } = useSWR('config'); 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']; const sourceValues = ['mse', 'webrtc', 'jsmpeg'];
if (!config || !sourceIsLoaded) { if (!config || !sourceIsLoaded) {
@ -80,3 +83,16 @@ export default function Birdseye() {
</div> </div>
); );
} }
function getDefaultLiveMode(config) {
if (config) {
if (config.birdseye.restream) {
return config.ui.live_mode;
}
return 'jsmpeg';
}
return undefined;
}

View File

@ -32,7 +32,7 @@ export default function Camera({ camera }) {
: 0; : 0;
const [viewSource, setViewSource, sourceIsLoaded] = usePersistence( const [viewSource, setViewSource, sourceIsLoaded] = usePersistence(
`${camera}-source`, `${camera}-source`,
getDefaultLiveMode(config, cameraConfig) getDefaultLiveMode(config, cameraConfig, restreamEnabled)
); );
const sourceValues = restreamEnabled ? ['mse', 'webrtc', 'jsmpeg'] : ['jsmpeg']; const sourceValues = restreamEnabled ? ['mse', 'webrtc', 'jsmpeg'] : ['jsmpeg'];
const [options, setOptions] = usePersistence(`${camera}-feed`, emptyObject); const [options, setOptions] = usePersistence(`${camera}-feed`, emptyObject);