mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-19 15:26:29 +00:00
Merge pull request #1171 from allenporter/camera-webrtc
Update developer docs to mention RTSP to WebRTC
This commit is contained in:
commit
5d9b4e00bf
@ -91,6 +91,25 @@ class MyCamera(Camera):
|
|||||||
"""Handle the WebRTC offer and return an answer."""
|
"""Handle the WebRTC offer and return an answer."""
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### RTSP to WebRTC
|
||||||
|
|
||||||
|
An integration may provide a WebRTC stream for any RTSP camera using `async_register_rtsp_to_web_rtc_provider`. The current best practice is for an integration to provide the actual stream manipulation with an Add-on or external service.
|
||||||
|
|
||||||
|
|
||||||
|
```python
|
||||||
|
async def handle_offer(stream_source: str, offer_sdp: str) -> str:
|
||||||
|
"""Handle the signal path for a WebRTC stream and return an answer."""
|
||||||
|
try:
|
||||||
|
return await client.offer(offer_sdp, stream_source)
|
||||||
|
except ClientError as err:
|
||||||
|
raise HomeAssistantError from err
|
||||||
|
|
||||||
|
# Call unsub() when integration unloads
|
||||||
|
unsub = camera.async_register_rtsp_to_web_rtc_provider(
|
||||||
|
hass, DOMAIN, handle_offer
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
### Turn on
|
### Turn on
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
Loading…
x
Reference in New Issue
Block a user