Support HLS Fallback for WebRTC cameras #1030
Replies: 5 comments 28 replies
-
See the initial discussion for this feature it was decided not to allow supporting multiple stream types, but instead force cameras to support one or the other: #640 (comment) -- but does it already work this way after home-assistant/core#80646 ? |
Beta Was this translation helpful? Give feedback.
-
Thanks @allenporter. As for the PR, it's what allows this fallback to work (and another point in favor of revisiting the discussion, since it also supersedes the discussion), but the media source browser excludes WebRTC cameras. That's why I suggested changing this if statement. |
Beta Was this translation helpful? Give feedback.
-
Seems like (at least some) WebRTC Nest cameras can supply HLS streams. I also created a PR to allow Frigate cameras to stream HLS even when they're set up as WebRTC cameras. Maybe we can just show WebRTC cameras in the media browser, and worst case some Nest cameras will fail? |
Beta Was this translation helpful? Give feedback.
-
Seems like the new WebRTC implementation is breaking the HLS fallback for WebRTC cameras. What's preventing us from having the fallback work again? |
Beta Was this translation helpful? Give feedback.
-
I agree with this, but I think this case is a bit different because:
I believe Frigate passes as an "actual device", but I don't see why it matters - from HA's perspective, there are cameras that support WebRTC and RTSP. Frigate using go2rtc is an implementation detail that is not exposed to HA, and can change. Note that it's not the integrations, but rather the NVR itself. Imagine this was a hardware NVR. The integration does use the relevant APIs, and supported the both WebRTC and HLS up until 2024.11. |
Beta Was this translation helpful? Give feedback.
-
Cameras that support WebRTC provide lower latency and smooth playback. They do have on major downside though - they're not supported as media source.
I propose we allow WebRTC cameras to fallback to HLS, so that WebRTC is used when the camera is streamed by the HA frontend, and HLS when it's consumed as a media source.
The code change is pretty minimal - adding another value to
StreamType
to represent the new type, and changing this if statement and this one accordingly, and a couple of if statements on the frontend. (for completeness, this if statement can also be changed to allow better error handling).Cameras that want to benefit from this change will use the new
StreamType
, and implement bothstream_source
andasync_handle_web_rtc_offer
, rather than just one of them.Beta Was this translation helpful? Give feedback.
All reactions