Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions homeassistant/components/camera/media_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,17 @@ async def async_resolve_media(self, item: MediaSourceItem) -> PlayMedia:
f"/api/camera_proxy_stream/{camera.entity_id}", camera.content_type
)

if stream_type != StreamType.HLS:
raise Unresolvable("Camera does not support MJPEG or HLS streaming.")

if "stream" not in self.hass.config.components:
raise Unresolvable("Stream integration not loaded")

try:
url = await _async_stream_endpoint_url(self.hass, camera, HLS_PROVIDER)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm on my phone, what does the error handling do here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose it was meant to return a meaningful message to end-user (which this PR keeps).

except HomeAssistantError as err:
# Handle known error
if stream_type != StreamType.HLS:
raise Unresolvable(
"Camera does not support MJPEG or HLS streaming."
) from err
raise Unresolvable(str(err)) from err

return PlayMedia(url, FORMAT_CONTENT_TYPE[HLS_PROVIDER])
Expand Down