home-assistant / frontend

:lollipop: Frontend for Home Assistant
https://demo.home-assistant.io
Other
4.06k stars 2.78k forks source link

Unhandled exception when casting local media #21109

Closed phoenix-9 closed 1 month ago

phoenix-9 commented 4 months ago

Checklist

Describe the issue you are experiencing

I use hass.io. I have movies in "My media". I also have security cameras (Unifi). I have a few Google Chromecast TV dongles.

If I cast the security cameras to the Google Chromecast devices, it works perfectly.

If I try to cast a local video file, it fails with an unhandled exception (see below). At the same time, I get the following error in the log: Failed to cast media https://hassio.mclemente.net:8123/media/local/Video/9.mkv?authSig=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJiMmI1Mzg5MzhlYjc0OWJjYWYxMjZjMmVmMzIzODc3MSIsInBhdGgiOiIvbWVkaWEvbG9jYWwvVmlkZW8vOS5ta3YiLCJwYXJhbXMiOltdLCJpYXQiOjE3MTg3MTE3MDcsImV4cCI6MTcxODc5ODEwN30.pzEXh9evFPN304H31pU4GmWr2JOegUDozPpFvg_GRS4 from internal_url (https://hassio.mclemente.net:8123). Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address

It is quite possible that there is an issue with DNS and IP addresses. Homeassistant has a 192.168.x.x ip address. Chromecast insists on trying to resolve using Google's DNS servers (8.8.8.8) and that returns the external ip address. Homeassistant should be reachable on either the internal or external address should be reachable by the Chromecast device. The external address gets forwarded to the internal address by the router.

Describe the behavior you expected

I expect the Chromecast device to start playing the video file. Instead the Chromecast plays a black screen with a spinning circle.

Steps to reproduce the issue

1. 2. 3. ...

What version of Home Assistant Core has the issue?

2024.6.3

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue with?

No response

Which operating system are you using to run this browser?

linux/debian/chromium

State of relevant entities

No response

Problem-relevant frontend configuration

No response

Javascript errors shown in your browser console/inspector

No response

Additional information

Logger: aiohttp.server Source: /usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py:421 First occurred: 06:55:12 (1 occurrences) Last logged: 06:55:12

Unhandled exception Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 531, in start resp, reset = await task ^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 477, in _handle_request reset = await self.finish_response(request, resp, start_time) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 630, in finish_response await prepare_meth(request) File "/usr/local/lib/python3.12/site-packages/aiohttp/web_fileresponse.py", line 303, in prepare return await self._sendfile(request, fobj, offset, count) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/web_fileresponse.py", line 96, in _sendfile await loop.sendfile(transport, fobj, offset, count) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1231, in sendfile return await self._sendfile_fallback(transport, file, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1252, in _sendfile_fallback read = await self.run_in_executor(None, file.readinto, view) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ OSError: [Errno 5] I/O error

github-actions[bot] commented 1 month ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.