Add support for custom go2rtc streams.

This commit is contained in:
Dermot Duffy
2023-02-26 13:52:24 -08:00
parent 9aff5ee76c
commit fcc2c5dd99
8 changed files with 32 additions and 4 deletions
+2
View File
@@ -174,6 +174,7 @@ cameras:
| Option | Default | Overridable | Description |
| - | - | - | - |
| `modes` | `[webrtc, mse, mp4, mjpeg]` | :heavy_multiplication_x: | An ordered array of `go2rtc` modes to use. Valid values are `webrtc`, `mse`, `mp4` or `mjpeg` values. |
| `stream` | Determind by camera engine (e.g. `frigate` camera name). | :heavy_multiplication_x: | A valid `go2rtc` stream name. |
#### Camera WebRTC Card configuration
@@ -1392,6 +1393,7 @@ cameras:
- mse
- mp4
- mjpeg
stream: sitting_room
```
</details>
+1 -1
View File
@@ -1093,7 +1093,7 @@ export class FrigateCameraManagerEngine
// go2rtc is exposed by the integration under the (slightly
// misleading) 'mse' path, even though that path can serve all go2rtc
// modes.
`/mse/api/ws?src=${cameraConfig.frigate.camera_name}`,
`/mse/api/ws?src=${cameraConfig.go2rtc?.stream ?? cameraConfig.frigate.camera_name}`,
sign: true,
};
};
+1
View File
@@ -13,6 +13,7 @@ export const CONF_CAMERAS_ARRAY_FRIGATE_LABEL =
export const CONF_CAMERAS_ARRAY_FRIGATE_URL = `${CONF_CAMERAS}.#.frigate.url` as const;
export const CONF_CAMERAS_ARRAY_FRIGATE_ZONE = `${CONF_CAMERAS}.#.frigate.zone` as const;
export const CONF_CAMERAS_ARRAY_GO2RTC_MODES = `${CONF_CAMERAS}.#.go2rtc.modes` as const;
export const CONF_CAMERAS_ARRAY_GO2RTC_STREAM = `${CONF_CAMERAS}.#.go2rtc.stream` as const;
export const CONF_CAMERAS_ARRAY_HIDE = `${CONF_CAMERAS}.#.hide` as const;
export const CONF_CAMERAS_ARRAY_ID = `${CONF_CAMERAS}.#.id` as const;
export const CONF_CAMERAS_ARRAY_TITLE = `${CONF_CAMERAS}.#.title` as const;
+2 -1
View File
@@ -130,6 +130,7 @@ import {
CONF_PERFORMANCE_FEATURES_MEDIA_CHUNK_SIZE,
MEDIA_CHUNK_SIZE_MAX,
CONF_CAMERAS_ARRAY_GO2RTC_MODES,
CONF_CAMERAS_ARRAY_GO2RTC_STREAM,
CONF_CAMERAS_ARRAY_HIDE,
} from './const.js';
import { localize } from './localize/localize.js';
@@ -1436,7 +1437,7 @@ export class FrigateCardEditor extends LitElement implements LovelaceCardEditor
}
)}
${this._renderStringInput(
getArrayConfigPath(CONF_CAMERAS_ARRAY_WEBRTC_CARD_URL, cameraIndex),
getArrayConfigPath(CONF_CAMERAS_ARRAY_GO2RTC_STREAM, cameraIndex),
)}`,
)}
${this._putInSubmenu(
+2 -1
View File
@@ -31,7 +31,8 @@
"webrtc": "Web Real-Time Communication (WebRTC)",
"mp4": "MPEG-4 (MP4)",
"mjpeg": "Motion JPEG (MJPEG)"
}
},
"stream": "go2rtc stream name"
},
"hide": "Hide camera from UI",
"icon": "Icon for this camera (Autodetected from entity)",
+11
View File
@@ -23,6 +23,17 @@
"url": "Frigate URL del server",
"zone": "Frigate zona"
},
"go2rtc": {
"editor_label": "",
"modes": {
"editor_label": "",
"mse": "",
"webrtc": "",
"mp4": "",
"mjpeg": ""
},
"stream": ""
},
"hide": "",
"icon": "Icona per questa telecamera (Autoidentificato dall'entità)",
"id": "ID univoco per questa telecamera in questa carta",
+11
View File
@@ -23,6 +23,17 @@
"url": "URL do servidor Frigate",
"zone": "Zona do Frigate"
},
"go2rtc": {
"editor_label": "",
"modes": {
"editor_label": "",
"mse": "",
"webrtc": "",
"mp4": "",
"mjpeg": ""
},
"stream": ""
},
"hide": "",
"icon": "Ícone para esta câmera (detectado automaticamente pela entidade)",
"id": "ID exclusivo para esta câmera nesse cartão",
+2 -1
View File
@@ -448,7 +448,8 @@ const cameraConfigSchema = z
go2rtc: z
.object({
modes: z.enum(['webrtc', 'mse', 'mp4', 'mjpeg']).array(),
modes: z.enum(['webrtc', 'mse', 'mp4', 'mjpeg']).array().optional(),
stream: z.string().optional(),
})
.optional(),