Replace Camera STREAM_ constants with StreamType enum (#69871)
This commit is contained in:
parent
75fce1f036
commit
c93c7e8eff
8 changed files with 56 additions and 36 deletions
|
@ -21,7 +21,7 @@ from homeassistant.exceptions import HomeAssistantError
|
|||
from homeassistant.helpers.entity_component import EntityComponent
|
||||
|
||||
from . import Camera, _async_stream_endpoint_url
|
||||
from .const import DOMAIN, STREAM_TYPE_HLS
|
||||
from .const import DOMAIN, StreamType
|
||||
|
||||
|
||||
async def async_get_media_source(hass: HomeAssistant) -> CameraMediaSource:
|
||||
|
@ -52,7 +52,7 @@ class CameraMediaSource(MediaSource):
|
|||
f"/api/camera_proxy_stream/{camera.entity_id}", camera.content_type
|
||||
)
|
||||
|
||||
if stream_type != STREAM_TYPE_HLS:
|
||||
if stream_type != StreamType.HLS:
|
||||
raise Unresolvable("Camera does not support MJPEG or HLS streaming.")
|
||||
|
||||
if "stream" not in self.hass.config.components:
|
||||
|
@ -86,7 +86,7 @@ class CameraMediaSource(MediaSource):
|
|||
if stream_type is None:
|
||||
content_type = camera.content_type
|
||||
|
||||
elif can_stream_hls and stream_type == STREAM_TYPE_HLS:
|
||||
elif can_stream_hls and stream_type == StreamType.HLS:
|
||||
content_type = FORMAT_CONTENT_TYPE[HLS_PROVIDER]
|
||||
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue