feat: Enable go2rtc live stream proxying (#2159)

- Closes #1984
This commit is contained in:
Dermot Duffy
2025-08-28 21:19:19 -07:00
committed by GitHub
parent c3d95a5b32
commit bc5022ef1a
29 changed files with 479 additions and 282 deletions
+9 -5
View File
@@ -265,10 +265,10 @@ cameras:
Configures whether and how the content is proxied via
[hass-web-proxy-integration](https://github.com/dermotduffy/hass-web-proxy-integration)
(this must be installed separately). This allows fetching media **through** the
Home Assistant process itself, allowing the card to access resources it
otherwise would not be able to directly access. There are [security and
performance
(this must be installed separately). This allows fetching media or live streams
**through** the Home Assistant process itself, allowing the card to access
resources it otherwise would not be able to directly access. There are [security
and performance
implications](https://github.com/dermotduffy/hass-web-proxy-integration?tab=readme-ov-file#considerations)
to consider before installing
[hass-web-proxy-integration](https://github.com/dermotduffy/hass-web-proxy-integration)
@@ -283,7 +283,9 @@ cameras:
![Camera Proxying](../../images/proxy.png 'Camera Proxying :size=400')
Not all [engines](./engine.md) benefit from proxying:
For live streams, only the `go2rtc` [live provider](./live-provider.md) currently supports live stream proxying.
For media, not all [engines](./engine.md) benefit from proxying:
| Engine | Purpose of proxying |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -300,6 +302,7 @@ Proxying parameters:
| Option | Default | Description |
| ------------------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `live` | `auto` | Whether or not to proxy live streams. `true` to proxy, `false` to not proxy, or `auto` to allow the camera engine to decide whether to proxy or not. Not all [live providers](./live-provider.md) support proxying live streams. |
| `media` | `auto` | Whether or not to proxy media items. `true` to proxy, `false` to not proxy, or `auto` to allow the camera engine to decide whether to proxy or not. |
| `dynamic` | `true` | Whether to dynamically (at the time) request proxying of the required media item, or rely on statically user-configured pre-existing proxying. See the [hass-web-proxy-integration documentation](https://github.com/dermotduffy/hass-web-proxy-integration). |
| `ssl_verification` | `auto` | Whether to verify the validity of SSL certificates. If `true` always verifies, if `false` never verifies and if `auto` the [engine](./engine.md) decides the best setting for that camera ecosystem. |
@@ -431,6 +434,7 @@ cameras:
preset: window
- camera_entity: camera.needs_proxy
proxy:
live: auto
media: auto
dynamic: true
ssl_verification: auto
+11 -9
View File
@@ -4,15 +4,15 @@
The `live_provider` parameter determines what provides the live stream for a camera. Each provider offers different capabilities:
| Live Provider | Latency | Frame Rate | Loading Time | Installation | Description |
| ---------------------------------- | ------- | ---------- | ------------ | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `go2rtc` | Best | High | Better | Builtin | Uses [go2rtc](https://github.com/AlexxIT/go2rtc) to stream live feeds. This is supported by Frigate >= `0.12`. |
| `ha` (default HA configuration) | Poor | High | Better | Builtin | Use the built-in Home Assistant camera stream. |
| `ha` (Native WebRTC) | Best | High | Better | Builtin | Use the built-in Home Assistant camera streams -- can be configured to use [native WebRTC](https://www.home-assistant.io/integrations/rtsp_to_webrtc/) offering a very low-latency feed direct to your browser. |
| `ha` (when configured with LL-HLS) | Better | High | Better | Builtin | Use the built-in Home Assistant camera streams -- can be configured to use an [LL-HLS](https://www.home-assistant.io/integrations/stream/#ll-hls) feed for lower latency. |
| `image` | Poor | Poor | Best | Builtin | Use refreshing snapshots of the built-in Home Assistant camera streams. |
| `jsmpeg` | Better | Low | Poor | Builtin | Use a the JSMPEG stream. |
| `webrtc-card` | Best | High | Better | Separate installation required | Embed's [AlexxIT's WebRTC Card](https://github.com/AlexxIT/WebRTC) to stream live feed, requires manual extra setup. See below. Not to be confused with native Home Assistant WebRTC (use the `ha` provider). |
| Live Provider | Latency | Frame Rate | Loading Time | Installation | Supports [Proxying](./README.md?id=proxy) | Description |
| ---------------------------------- | ------- | ---------- | ------------ | ------------------------------ | ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `go2rtc` | Best | High | Better | Builtin | :white_check_mark: | Uses [go2rtc](https://github.com/AlexxIT/go2rtc) to stream live feeds. This is supported by Frigate >= `0.12`. |
| `ha` (default HA configuration) | Poor | High | Better | Builtin | :heavy_multiplication_x: | Use the built-in Home Assistant camera stream. |
| `ha` (Native WebRTC) | Best | High | Better | Builtin | :heavy_multiplication_x: | Use the built-in Home Assistant camera streams -- can be configured to use [native WebRTC](https://www.home-assistant.io/integrations/rtsp_to_webrtc/) offering a very low-latency feed direct to your browser. |
| `ha` (when configured with LL-HLS) | Better | High | Better | Builtin | :heavy_multiplication_x: | Use the built-in Home Assistant camera streams -- can be configured to use an [LL-HLS](https://www.home-assistant.io/integrations/stream/#ll-hls) feed for lower latency. |
| `image` | Poor | Poor | Best | Builtin | :heavy_multiplication_x: | Use refreshing snapshots of the built-in Home Assistant camera streams. |
| `jsmpeg` | Better | Low | Poor | Builtin | :heavy_multiplication_x: | Use a the JSMPEG stream. |
| `webrtc-card` | Best | High | Better | Separate installation required | :heavy_multiplication_x: | Embed's [AlexxIT's WebRTC Card](https://github.com/AlexxIT/WebRTC) to stream live feed, requires manual extra setup. See below. Not to be confused with native Home Assistant WebRTC (use the `ha` provider). |
## `go2rtc`
@@ -32,6 +32,8 @@ cameras:
| `stream` | Determined by camera engine (e.g. `frigate` camera name). | A valid `go2rtc` stream name. |
| `url` | Determined by camera engine (e.g. the `frigate` engine will automatically generate a URL for the go2rtc backend that runs in the Frigate container). | The root `go2rtc` URL the card should stream the video from. This is only needed for non-Frigate usecases, or advanced Frigate usecases. Example: `http://my-custom-go2rtc:1984` |
?> If `url` is manually set and `proxy.live` is set to `auto` on the camera (the default), the video stream will automatically be proxied via the Home Assistant process if the [hass-web-proxy-integration](https://github.com/dermotduffy/hass-web-proxy-integration) is detected. See [proxying](./README.md?id=proxy).
## `image`
All configuration is under:
+21
View File
@@ -488,6 +488,27 @@ folders:
regexp: 'Person.*'
```
## `go2rtc`
This example will use a custom `go2rtc` server, automatically proxying the video
stream via the Home Assistant process if
[hass-web-proxy-integration](https://github.com/dermotduffy/hass-web-proxy-integration)
is detected. See [proxying](./configuration/cameras/README.md?id=proxy).
```yaml
type: custom:advanced-camera-card
cameras:
- camera_entity: camera.office
live_provider: go2rtc
go2rtc:
# This would normally risk mixed content issues with browsers (accessing
# `http` content over a `https` connection to Home Assistant is often
# forbidden by browsers). In this scenario, since hass-web-proxy-integration
# has been installed separately by the user, the video will be automatically
# proxied.
url: http://my-custom-go2rtc
```
## Human interaction
This example will automatically use a HD live substream when
+16
View File
@@ -217,6 +217,22 @@ providers](./configuration/cameras/live-provider.md) such as `image` or `jsmpeg`
The card will only show the fullscreen menu button when fullscreen can usefully
be activated, which means for certain views on the iPhone it will be absent.
### Custom `go2rtc` server only works on Home Network
This card runs in your browser, and (if configured) attempts to opens a direct
connection to a `go2rtc` server. If you are manually specifying a custom server
using the [`url`](./configuration/cameras/live-provider.md?id=go2rtc) option,
your browser may only be able to access that server when you're on the same
network, and/or when both Home Assistant and the `go2rtc` server are both
accessed over `http` or both over `https`.
To automatically proxy the connection via the Home Assistant process instead
(ensuring that if you can access the card, you'll always have access to the
`go2rtc` server), optionally install
[hass-web-proxy-integration](https://github.com/dermotduffy/hass-web-proxy-integration)
and your connection will be automatically proxied. See
[proxying](./configuration/cameras/README.md?id=proxy).
### iOS App not updating after card version change
Try resetting the app frontend cache: