Rewrite restream (#5106)

* Tear out restream config

* Rework birdseye restream

* Create go2rtc config handler

* Fix bug

* Write start script

* Rework style

* Fix python run syntax

* Output as json instead of yaml

* Put old live config back and fix birdseye references

* Fix camera webUI

* Add frigate env var subsitutions

* Fix webui checks

* Check keys

* Remove unused prest

* Fix tests

* Update restream docs

* Update restream docs

* Update live docs

* Update camera specific recommendation

* Update more docs

* add links for the docs

Co-authored-by: Felipe Santos <felipecassiors@gmail.com>

* Update note about supported audio codecs

* Move restream to go2rtc

* Docs fixes

* Add verification of stream name

* Ensure that webUI uses camera name

* Update docs to reflect new live stream name

* Fix check

* Formatting

* Remove audio from detect

Co-authored-by: Felipe Santos <felipecassiors@gmail.com>

* Fix docs

* Don't handle env variable substitution

* Add go2rtc version

* Clarify docs

Co-authored-by: Felipe Santos <felipecassiors@gmail.com>
This commit is contained in:
Nicolas Mowen
2023-01-16 16:50:35 -07:00
committed by GitHub
parent a7751f210b
commit 19afb035ff
17 changed files with 212 additions and 406 deletions

View File

@@ -18,7 +18,7 @@ export default function Birdseye() {
}
let player;
if (viewSource == 'mse' && config.restream.birdseye) {
if (viewSource == 'mse' && config.birdseye.restream) {
if ('MediaSource' in window) {
player = (
<Fragment>
@@ -36,7 +36,7 @@ export default function Birdseye() {
</Fragment>
);
}
} else if (viewSource == 'webrtc' && config.restream.birdseye) {
} else if (viewSource == 'webrtc' && config.birdseye.restream) {
player = (
<Fragment>
<div className="max-w-5xl">
@@ -61,7 +61,7 @@ export default function Birdseye() {
Birdseye
</Heading>
{config.restream.birdseye && (
{config.birdseye.restream && (
<select
className="basis-1/8 cursor-pointer rounded dark:bg-slate-800"
value={viewSource}

View File

@@ -25,14 +25,15 @@ export default function Camera({ camera }) {
const [viewMode, setViewMode] = useState('live');
const cameraConfig = config?.cameras[camera];
const restreamEnabled = cameraConfig && Object.keys(config.go2rtc.streams).includes(cameraConfig.live.stream_name);
const jsmpegWidth = cameraConfig
? Math.round(cameraConfig.restream.jsmpeg.height * (cameraConfig.detect.width / cameraConfig.detect.height))
? Math.round(cameraConfig.live.height * (cameraConfig.detect.width / cameraConfig.detect.height))
: 0;
const [viewSource, setViewSource, sourceIsLoaded] = usePersistence(
`${camera}-source`,
getDefaultLiveMode(config, cameraConfig)
);
const sourceValues = cameraConfig && cameraConfig.restream.enabled ? ['mse', 'webrtc', 'jsmpeg'] : ['jsmpeg'];
const sourceValues = restreamEnabled ? ['mse', 'webrtc', 'jsmpeg'] : ['jsmpeg'];
const [options, setOptions] = usePersistence(`${camera}-feed`, emptyObject);
const handleSetOption = useCallback(
@@ -106,7 +107,7 @@ export default function Camera({ camera }) {
let player;
if (viewMode === 'live') {
if (viewSource == 'mse' && cameraConfig.restream.enabled) {
if (viewSource == 'mse' && restreamEnabled) {
if ('MediaSource' in window) {
player = (
<Fragment>
@@ -124,7 +125,7 @@ export default function Camera({ camera }) {
</Fragment>
);
}
} else if (viewSource == 'webrtc' && cameraConfig.restream.enabled) {
} else if (viewSource == 'webrtc' && restreamEnabled) {
player = (
<Fragment>
<div className="max-w-5xl">
@@ -136,7 +137,7 @@ export default function Camera({ camera }) {
player = (
<Fragment>
<div>
<JSMpegPlayer camera={camera} width={jsmpegWidth} height={cameraConfig.restream.jsmpeg.height} />
<JSMpegPlayer camera={camera} width={jsmpegWidth} height={cameraConfig.live.height} />
</div>
</Fragment>
);
@@ -200,9 +201,9 @@ export default function Camera({ camera }) {
);
}
function getDefaultLiveMode(config, cameraConfig) {
function getDefaultLiveMode(config, cameraConfig, restreamEnabled) {
if (cameraConfig) {
if (cameraConfig.restream.enabled) {
if (restreamEnabled) {
return config.ui.live_mode;
}