-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to cast in HLS format when using WebRTC #80646
Conversation
Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration ( |
Hello, this does not address what I said in #79494 (comment) The issue is not just how to get this working, but about the technical decisions around the entity model. |
I truly understand, and I wish that WebRTC streaming gets implemented. If it gets implemented, I believe streaming with both formats will have no use. But nevertheless this is a short-term, harmless workaround that allow people to continue streaming in HLS format while using WebRTC, until the definitive solution gets implemented (which I'm assuming won't be soon). |
Let me elaborate since I think it may not be clear based on your response: The first part of what I said is that there needs to be an architecture discussion to change the rules of the entity model. This is what I meant above by "The issue is not just how to get this working, but about the technical decisions around the entity model." |
@balloob since you added this guard, curious for your hot take. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah seems fine. I think what happened is i migrated logic from the entity, and there it used to be limited
@@ -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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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).
Breaking change
N/A
Proposed change
See the linked issue for background, but the long story short is that casting cameras is no longer possible once you enable the native WebRTC integration.
After further analysis, it turns out that casting were being blocked by a constant check, i.e. the camera is fully able to supply a stream in HLS format but since its main format was set to WebRTC it was failing early.
This PR makes this behavior more tolerant, while still retaining the original error handle for returning a helpful message.
The format check is not decisive any longer, but instead we try to fetch a stream URL in HLS format.
If it succeeds, it means the camera is capable of providing a HLS stream and therefore it can be casted
If it fails, we still check for the original error for the sake of hinting the user on why it probably failed.
It's working normally on my main Home Assistant instance.
/cc @allenporter @dermotduffy
Type of change
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.To help with the load of incoming pull requests: