You need an auth token to access the file directly. If you log into the HA UI from the browser first and then navigate to the file directly, does it work?
Maybe not. I just tested a file in /www/media with nothing in config around external directories nor trusted networks and was able to hit it. This was using an incognito tab in Chrome, so no previous auth token.
Hi. Thanks! When I try from the same or different browser, the log file shows the same, even using an incognito tab. So even if I’m logged in to HA, it won’t serve it.
When I try to play the file from my media folder within HA, the path is /media/local/1.mp3
I’m stumped. The issue prevents playing the media files on HA on my HEOS receiver.
I struggled with the same issue - only some bits of HA can access the files in /media.
I tried putting some images I wanted to use in dashboards in there - convenient, easy upload from ui but couldn’t access them from the dashboard cards.
Gave up and used config/www instead - there is no access control intentionally.
I don’t think I understand the intended purpose of /media and the consequent limitations.
I have the same “issue”.
I have not enough urgence yet to look at it, but it really is what @FriedCheese mentioned. There is token required to access the files.
My Marantz shows the message “unable to play file”
It looks like “/media” is a protected folder with default access given only to HA. My read is that the ‘allowlist’ options makes the folder available to other integrations but not external.
If you want to make them available externally, use /config/www/media instead.
Unless something isn’t setup right on my HA, with my original configuration it seems like even ‘allowlist’ doesn’t make the media available to other integrations (e.g., my HEOS receiver).
So, as you suggest, I moved the media folder to ‘/config/www/Music’ (configuration.yaml below) and I can access a test mp3 remotely with ‘http://HA_ip:8123/local/Music/3.mp3’
I can play that file directly through the HA browser to my cpu. But when I try to play that file through the HA browser to the HEOS device, the log again shows this entry:
Login attempt or request with invalid authentication from WRT1200AC.lan (192.168.21.1). Requested URL: ‘/media/remote/3.mp3?authSig%3DeyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI1ZjNmYzBhODNkNTE0MmFjOTNhYWEyOGVlOGIwNjE3MCIsInBhdGgiOiIvbWVkaWEvcmVtb3RlLzMubXAzIiwicGFyYW1zIjpbXSwiaWF0IjoxNjkxOTM5MjI4LCJleHAiOjE2OTIwMjU2Mjh9.XEb44’. (AvegaMediaServer/2.0 Linux/2.6)
If I’m not misunderstanding something, it looks like HA is telling the HEOS device to 1) use auth still and 2) not use the right path.
Hey. Thanks. Keeping the files in config/www, I can indeed play the music on my HEOS device with the service now too, which is an improvement over having the media in the default local location. But when I select the music from HA’s media browser to play on my HEOS devices, I still get this log entry representing the failure:
Login attempt or request with invalid authentication from WRT1200AC.lan (192.168.21.1). Requested URL: ‘/media/remote/3.mp3?authSig%3DeyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI1ZjNmYzBhODNkNTE0MmFjOTNhYWEyOGVlOGIwNjE3MCIsInBhdGgiOiIvbWVkaWEvcmVtb3RlLzMubXAzIiwicGFyYW1zIjpbXSwiaWF0IjoxNjkxOTM5MjI4LCJleHAiOjE2OTIwMjU2Mjh9.XEb44’. (AvegaMediaServer/2.0 Linux/2.6)
So it looks like HA’s media browser is telling the HEOS device to 1) use auth still and 2) not use the right path. That’s the key issue now since it prevents using the media browser to play the songs anywhere other than on the browser.
Files served from media are protected by Home Assistant authentication unlike those served from www
Even if you add a folder to the media path in the confiration.yaml, it is served ass media thus protected.
I’m not sure if this is a bug of such kind. #3D is the UTF for a = sign and the '. at the end of the string does not seem to be really good.
For my application, my findings are usable, but if you are plannign to use it as a jukebox, this is a no-go.
However… I have some buttons created from the media library to stream some radio stations to the same receiver, so that is working perfectly fine…
Media streaming from Media and the HA autentication is working fine for e.g. Nest Hub or my android device. Guess this is a HEOS thing not working at is best
Totally with you that files served from media are protected and those from www are not. That is also what I am experiencing.
I’ve also got some buttons that stream some radio stations that work great, and if I call the media play service directly with the path to the files in www, the media plays also, so I know the HEOS device can get things to play.
But, when using HA’s media browser to play files from www to the HEOS devices, that’s where things go wrong. Unfortunately for me, I don’t have a non-HEOS device to test to see if the path that HA sends is right and the auth stuff in the link is removed.