Media_play does not work

Greetings,

I do not seem to get my speakers to play local hosted files. I have tried numerous things. The error that I get is:

Logger: homeassistant.components.cast.media_player
Source: components/cast/media_player.py:348
Integration: Google Cast (documentation, issues)
First occurred: 9:38:52 AM (11 occurrences)
Last logged: 9:51:56 AM

Failed to cast media https://[xxx].duckdns.org/test2.mp3 from internal_url (https://[xxx].duckdns.org). Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address
Failed to cast media http://[ownIP[/test2.mp3. Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address
Failed to cast media https://home-assistant.io/images/cast/splash.png. Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address
Failed to cast media \\192.168.178.100\media\Testme2.mp3. Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address
Failed to cast media http://192.168.178.100/media/Testme2.mp3. Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address

My config:

System Health

arch aarch64
chassis embedded
dev false
docker true
docker_version 19.03.8
hassio true
host_os HassOS 4.10
installation_type Home Assistant OS
os_name Linux
os_version 4.19.126-v8
python_version 3.8.6
supervisor 2020.10.1
timezone Europe/Amsterdam
version 0.117.2
virtualenv false

Lovelace

dashboards 2
mode auto-gen
resources 0

I have tried numerous things;

  • Setting up the external URL to https://[xxx].duckdns.org
  • TTS seems to create the TTS files on homeassistant, so it is reachable HOWEVER, it does not play the TTS files, due ot the same error.
  • Home assistant is controllable externally.
  • I can control Home Assistant via Google Assistant with the google assistant integration
  • It can cast internet hosted files, so there must be something wrong with my config to reach the home assistant instance…

See: https://www.home-assistant.io/docs/configuration/basic/#allowlist_external_dirs

Will try. Guess ill have to expose the www, media and tts folder.

Keep you posted

Update: Did not work. Same error persists.

If you want to play local content, the easiest way is to serve the files over http from the www folder, or a subfolder of the www folder since it is already exposed by the HA webserver as /local.

So, try the following:
Make a subfolder named media in your www folder and place the media file there.
Add this as content_id to your service call:

http://your_internal_ha_ip:your_ha_port/local/media/Testme2.mp3

Here is an example that works for me from the developer tools console:

entity_id: media_player.living_room
media_content_id: 'http://192.168.1.206:8123/local/media/test.mp3'
media_content_type: music

Hi tjntomas,

Unfortunately; didnt work:

entity_id: media_player.home_mini
media_content_id: 'http://192.168.178.100:8123/local/media/Testme2.mp3'
media_content_type: music

Gives

Failed to cast media http://192.168.178.100:8123/local/media/Testme2.mp3. Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address

Works with https://[myduckdns]/local/media!!!
Also, it is case-sensitive…

Also media browser playing works. Only TTS is a challenge

are you using a proxy? If not, then you can only access internal stuff through your duckdns url.

I am not. It does work with duckdns now when I use Duckdns and have my Dirs exposed. Somehow TTS still does not work… tts folder is exposed though

Hello,
I’m also having this issue. From time to time, without making any changes, the music play and tts is streaming to my Google Home Mini. But in 99% cases, both options are not working.
The error:

2020-11-13 22:09:41 ERROR (Thread-7) [homeassistant.components.cast.media_player] Failed to cast media ..... from internal_url (https://a....:8123). Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address

The URL is available from internal and external access on the same address and port. All other functions related to this device are working.

Home assistant works in mysterious ways…I added some suggested configuration lines in my config.yaml, and later commented it, and deleted it. Then it worked.

Currently streaming mp3 files works like a charm. TTS is still an issue somehow.

For me, media and tts are not working again. They worked for a while, now dead again.
I can assure that every of these files below (masked for privacy) are publicly accessible.
I asked a friend of mine, outside of my local network, to open them, and he could open all files.

## Dettagli registro (ERROR)

Logger: homeassistant.components.cast.media_player
Source: components/cast/media_player.py:348
Integration: Google Cast ([documentation](https://www.home-assistant.io/integrations/cast), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+cast%22))
First occurred: 12 novembre 2020, 19:17:20 (12 occurrences)
Last logged: 18:19:49

* Failed to cast media https://xxxxxxx:8123/media/music/Aretha Franklin/30 Greatest Hits/1-04 Dr. Feelgood.mp3?authSig=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJkODg3NjYzZGMxMDU0Mjc4OGQ2Zjk1OWZlZDcxZTY2ZSIsInBhdGgiOiIvbWVkaWEvbXVzaWMvQXJldGhhIEZyYW5rbGluLzMwIEdyZWF0ZXN0IEhpdHMvMS0wNCBEci4gRmVlbGdvb2QubXAzIiwiaWF0IjoxNjA1MjA1MDUzLCJleHAiOjE2MDUyMDUzNTN9.Rd9HO1N2uBZLqGTdDdaxdkjpQWPtJJ4KZBn6EES-T7k from internal_url (https://xxxxxx:8123). Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address
* Failed to cast media https://xxxxxxxx:8123/media/music/Aretha Franklin/30 Greatest Hits/1-04 Dr. Feelgood.mp3?authSig=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJkODg3NjYzZGMxMDU0Mjc4OGQ2Zjk1OWZlZDcxZTY2ZSIsInBhdGgiOiIvbWVkaWEvbXVzaWMvQXJldGhhIEZyYW5rbGluLzMwIEdyZWF0ZXN0IEhpdHMvMS0wNCBEci4gRmVlbGdvb2QubXAzIiwiaWF0IjoxNjA1MjA1MDU3LCJleHAiOjE2MDUyMDUzNTd9.m9F8IigkccRWX7XtoAwyUORGAMqH_yCLQ96WJA42k-Y from internal_url (https://xxxxxxxx:8123). Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address
* Failed to cast media https://xxxxxxx:8123/api/tts_proxy/68377bdbe20b62e2df883e3d5b1120bcc77973db_it_-_google_translate.mp3 from internal_url (https://xxxxxxx:8123). Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address
* Failed to cast media https://xxxxxxxxx:8123/media/music/Gorillaz/Gorillaz/05 Clint Eastwood.mp3?authSig=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJkODg3NjYzZGMxMDU0Mjc4OGQ2Zjk1OWZlZDcxZTY2ZSIsInBhdGgiOiIvbWVkaWEvbXVzaWMvR29yaWxsYXovR29yaWxsYXovMDUgQ2xpbnQgRWFzdHdvb2QubXAzIiwiaWF0IjoxNjA1NzE5OTgxLCJleHAiOjE2MDU3MjAyODF9.A9VlA_QQRh6kItrjmf4SOvKFH4PE61Gy71of45s36S4 from internal_url (https://xxxxxx:8123). Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address
* Failed to cast media https://xxxxxxxx:8123/media/music/Gorillaz/Gorillaz/05 Clint Eastwood.mp3?authSig=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJkODg3NjYzZGMxMDU0Mjc4OGQ2Zjk1OWZlZDcxZTY2ZSIsInBhdGgiOiIvbWVkaWEvbXVzaWMvR29yaWxsYXovR29yaWxsYXovMDUgQ2xpbnQgRWFzdHdvb2QubXAzIiwiaWF0IjoxNjA1NzE5OTg5LCJleHAiOjE2MDU3MjAyODl9.zq7pBD9-q1vrpfT8DLsYS9-CDzJ2ftluIlOfUQa_6ok from internal_url (https://xxxxxxx:8123). Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address

For TTS issue I solved using base_url option pointing to my external url.
Probabily using https with local ip address is the cause.

4 Likes

Did you get a solution to “Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address”?
My TTS works fine; have included media dirs; externally accessible dirs; allowed external URLs, but cannot get any media files to cast to my speakers - only the “plink” sound and then silence…

hitting the same issue trying to use nabu casa cloud_say.

I have the same issue with my Google Home mini. TTS and casting media via HA is not working with the unreachable error message. Although, the HA is reachable via duckdns along with Google Assistant is linked and working correctly with HA. Anyone managed to find a working solution? Thanks.

Same here.

This fixed it. I replaced base_url with my nabu casa one, and its all working now. Feels like I shouldn’t have to do this however.

Has base_url not been deprecated? Thought it was replaced with external_url?
I have external_url pointing to http:://myexternalIP:8123 - but no joy :frowning:

I’m having the same issue as well. It started happening today, worked fine yesterday. I didn’t make any changes either to home assistant or to my cast devices.

I can’t cast TTS, music or videos. Getting the same loglines as mentioned above:

Failed to cast media https://r6---sn-uxaxovg-5god.googlevideo.com/videoplayback..... Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address

Failed to cast media https://www.home-assistant.io/images/cast/splash.png. Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address

Hi.
I have similar issue.
When I turn on the media player (Nest Mini) through the HomeAssistant card, this error occurs:

Logger: homeassistant.components.cast.media_player
Source: components/cast/media_player.py:348 
Integration: Google Cast (documentation, issues)
First occurred: 22:52:42 (1 occurrences) 
Last logged: 22:52:42

Failed to cast media https://www.home-assistant.io/images/cast/splash.png. Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address
1 Like

Thanks… this was the solution for me too!