Add support for custom go2rtc URLs.

This commit is contained in:
Dermot Duffy
2023-10-07 18:29:31 -07:00
parent cf8935da73
commit db50e36c76
5 changed files with 306 additions and 16 deletions
+14 -8
View File
@@ -1148,16 +1148,22 @@ export class FrigateCameraManagerEngine
};
const getGo2RTC = (): CameraEndpoint | null => {
return {
endpoint:
`/api/frigate/${cameraConfig.frigate.client_id}` +
// go2rtc is exposed by the integration under the (slightly
const stream = cameraConfig.go2rtc?.stream ?? cameraConfig.frigate.camera_name;
const url = cameraConfig.go2rtc?.url
? cameraConfig.go2rtc.url.replace(/\/+$/, '')
: null;
const endpoint = url
? `${url}/api/ws?src=${stream}`
: // 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.go2rtc?.stream ?? cameraConfig.frigate.camera_name
}`,
sign: true,
`/api/frigate/${cameraConfig.frigate.client_id}/mse/api/ws?src=${stream}`;
return {
endpoint: endpoint,
// Only sign the endpoint if it's local to HA.
sign: endpoint.startsWith('/'),
};
};