Web RTC client and signal path in Home Assistant #640
-
I would like to support the new Nest Battery Camera and Nest Battery Doorbell in Home Assistant. The camera differs from previous nest cameras in that instead of using an RTSP stream, only supports Web RTC. BackgroundA typical
The Nest SDM API for webrtc camera streams basically works like this:
ProposalThe high level idea is:
ConsiderationsThere are a few considerations to think through in more detail:
I'd love thoughts from @uvjustin and @hunterjm in particular. |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 2 replies
-
@AlexxIT as the author of https://github.com/AlexxIT/WebRTC I am curious if you have any thoughts or want to weigh in. |
Beta Was this translation helpful? Give feedback.
-
Implementation alternative: Preserve the notion of web rtc being a stream, and revamp all the assumptions about a stream and its interface with cameras and interface between frontend and core. |
Beta Was this translation helpful? Give feedback.
-
I don't foresee any issues with viewing it in the browsers which support WebRTC. As long as we can establish the connection, we should be good. For iOS, we can have it fallback to open the stream natively in the app, overlaying the whole webview. Recording not being part of it is also fine. Step 1 is to just view it. I think that instead of a |
Beta Was this translation helpful? Give feedback.
-
When I was initially building stream I was looking at using WebRTC for implementation. Specifically I played around with the aiortc library. That is how I discovered the It's honestly a lot to bite off, and has it's limitations. That being said, if you want Home Assistant core as a proxy to Nest it's honestly probably not much of a stretch to repackage the RTSP (or other stream source) packets coming out of |
Beta Was this translation helpful? Give feedback.
-
Talked through a bit with @hunterjm, @balloob, @uvjustin over discord and wanted to summarize my take-aways:
Feel free to chime in if i didn't capture an important point. ProposalElaborating on the above proposal in more detail:
I'd like to see if the |
Beta Was this translation helpful? Give feedback.
-
If the camera gives back WebRTC natively - that's great. The Hass is only needed for a secure SDP exchange. But it is not clear whether such cameras can bypass any NAT. My component can bypass some NATs, but not all. If NabuCasa is able to provide its users with a TURN server - that could be great. My component uses a binary to convert the RTSP stream into a WebRTC stream. SDP is transmitted via Hass authorization, and the video stream is transmitted directly between the browser and the binary. Therefore, when working externally through Nabu Casa - the video stream does not load the server NC, this is a plus. My component is able to transmit not only WebRTC, but also MSE within a single connection. Depending on the capabilities of the browser. I planned to develop it further - to no delay snapshots, etc. But for now I am busy with other projects. Mostly Xiaomi Gateway 3... |
Beta Was this translation helpful? Give feedback.
-
I'll add another note, that libnice can be used (as used in janus gateway) to determine what IP to feed the stream request. I used a modified Janus Gateway instance to utilize UPNP (set a boolean in the libnice API) to successfully forward the UDP port. A Janus Gateway addon to provide the webRTC server for camera streams should be pretty easy to throw together. |
Beta Was this translation helpful? Give feedback.
Talked through a bit with @hunterjm, @balloob, @uvjustin over discord and wanted to summarize my take-aways:
stream
WebRTC
component.