Replace Camera STREAM_TYPE_ constants with StreamType enum

This commit is contained in:
Franck Nijhof 2022-04-11 19:54:03 +02:00
parent 060292b0b4
commit ad2af0a875
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3

View File

@ -20,7 +20,7 @@ Properties should always only return information from memory and not do I/O (lik
| brand | str | `None` | The brand (manufacturer) of the camera. |
| model | str | `None` | The model of the camera. |
| frame_interval | float | 0.5 | The interval between frames of the stream. |
| frontend_stream_type | str | None | Used with `SUPPORT_STREAM` to tell the frontend which type of stream to use (`STREAM_TYPE_HLS` or `STREAM_TYPE_WEBRTC`) |
| frontend_stream_type | str | None | Used with `CameraEntityFeature.STREAM` to tell the frontend which type of stream to use (`StreamType.HLS` or `StreamType.WEB_RTC`) |
## Supported Features
@ -65,9 +65,9 @@ class MyCamera(Camera):
### Stream Source
The stream source should return a url that is usable by ffmpeg (e.g. an RTSP url). Requires `SUPPORT_STREAM`.
The stream source should return a url that is usable by ffmpeg (e.g. an RTSP url). Requires `CameraEntityFeature.STREAM`.
A camera entity with a stream source by default uses `STREAM_TYPE_HLS` to tell the frontend to use an HLS feed with the `stream` component. This stream source will also be used with `stream` for recording.
A camera entity with a stream source by default uses `StreamType.HLS` to tell the frontend to use an HLS feed with the `stream` component. This stream source will also be used with `stream` for recording.
```python
class MyCamera(Camera):
@ -81,7 +81,7 @@ A common way for a camera entity to render a camera still image is to pass the s
### WebRTC Streams
WebRTC enabled cameras can be used by facilitating a direct connection with the home assistant frontend. This usage requires `SUPPORT_STREAM` with `frontend_stream_type` set to `STREAM_TYPE_WEB_RTC`. The integration should implement `async_handle_web_rtc_offer` which passes the frontend's SDP offer to the device and returns back the answer.
WebRTC enabled cameras can be used by facilitating a direct connection with the home assistant frontend. This usage requires `CameraEntityFeature.STREAM` with `frontend_stream_type` set to `StreamType.WEB_RTC`. The integration should implement `async_handle_web_rtc_offer` which passes the frontend's SDP offer to the device and returns back the answer.
WebRTC streams do not use the `stream` component and do not support recording.