The media folder is setup, I can see files and folders in the Media Browser tab. I’ve tried various paths… I’ve watch the error logs, I’m still scratching my head.
Not sure then as to be honest I have only just noticed you are trying to play the file via a browser, I have never tried this.
I use the same function / automation to play a local mp3 file to a google hub and the example I gave regarding location works perfectly, maybe sending to browser is different in some way.
Files in /media the ones that show up with the Media Browser default settings are the ones setup to work the the “media-source://media_source/local” URL schema
The location you’re referring to with /media/local/… is not the same location as where the Media Browser / media_source is finding it’s media… the url you’re referencing is the local file system /config/www/
Once I figured that out I was able to move my files from /media to /config/www and get it working in the browser.
Yes the reason is that google will play the files locally, so my example /local is exactly that “local” and is definitely not available outside the local network and therefore is not referencing the www folder as this is available to anyone that has the link / address.
That also is the reason why when you reference a file in the www folder your browser will access it because it’s available too anyone with the address. However if you try to get your browser to access the /local folder I suspect it cant gain access.
home assistant default config puts media folder as /local unless changed in the config or not running a standard install / setup. So the only files I see in HA media browser are those files and folders in /media/local
Similarly the www folder as the name suggests is accessible from the outside world.
So you can play a local file on a local device by referencing location /local OR if you host a file in the www folder you can access / play that file from anywhere if you reference to the file in the www folder.
The files can be put into www/xxx.mp3 and then be referenced as https://homeassistant.example.com/local/xxx.mp3 in media_content_id assuming that https://homeassistant.example.com is the URL of your HA instance UI.
This way the files are available to other divices. See also Serving static files