Tons of questions about new media browser

Hi, I hope someone can help me about the media player usage…
I have HassOS on Raspberry Pi 4

I installed MPD (https://github.com/Poeschl/Hassio-Addons/tree/master/mpd to play TTS from the 3.5mm Pi jack and everything work like a charm.

Now I would like to play some MP3 that I put into ‘/media’ folder via samba.
I can see these files if I go to Media Browser on the sidebar menu, but when I try to play them using the service in Developer Tools I got always errors.
On dev tools I set:

service: media_player.play_media
entity: media_player.mpd

then in the data field, on media_content_id I tried any combination of paths I got searching on internet and on this page https://www.home-assistant.io/integrations/media_source/#playing-media-from-a-media-source but nothing works.

+1 i also like to choos the files from media browser direct in the media-control card in lovelace.

Are there allready a future request ?

4 Likes

Good evening
Dear
My media browser audio file unable to play on my Google home mini speaker .when I click the song only getting beep sound and stop media player .but is is playing well with web browser .
May I know how can I fix this issue

When I setup automation with sound then it is playing well.
Unfortunately I can not play directly from media browser

1 Like

Hello,
I will add my use case also.
THe component VLC need to have a full path of file in order to be able to play a song. As the media library path like 'media-source://media_source/local/filename.mp3' do not convert it, the VLC is not able to play songs.
My temporary workaround was to make a script that expect last part and concatenate with full path. The selection of music to play is available through an input select manually filled with the list of files by using a manual call to call service set options

- "my first song.mp3"
- "nice_group/favorite.mp3"
- ...

A button to call the script and it takes the value of input select

Is hassio broken out of the box for media-source: URLs sent to google cast integration entities?

I’m also having this problem right now. The last three posts on this thread in the last couple months are consistent with my experience, it simply doesn’t work. I observe the exact same behavior. Any chance this just hasn’t been working in HA for the past few months of releases?

I’ve tried dozens of URL variations for media-source:// urls, and tried configuring custom media folders too, but I can’t get google cast’s to play music from the local media source.

Play in browser from the Media Browser DOES work, but media-source URLs simply don’t, either directly entered to a play_media service call, or accessed from the Media Browser UX.

  1. I’m using Google cast hw, I have a few, different models none of them are working.
  2. I’m using Hass.io and its up to date
  3. You get an initial “pairing chime” from the speaker, but I cannot get media-source:// urls to work, cast HW never plays, and after chiming (like it was going to play) it transforms to an idle state within like half a second after the chime.
  4. I /suspect/ the media_content_id is being sent un-transformed to a real URL? But I can’t find a way to snoop on the chromecast using the google api. What code in github does the transformation? If I could find that logic, I could track this farther locally.
  5. I can wget from the media urls if I directly request, e.g. http://192.168.1.99/local/yaman.mp3 (192.168.1.99 is my HA) I get the file, so the media-source server is totally working.
  6. If I HARDODE a publicly available HTTP URL, or a private HTTP URL on a web server on the local network: Cast DOES work, so the valid HTTP URLs do work, again leading to my suspicion that its the media-source URL => http URL transformation taht’s not working (or isn’t happening).

Unfortunately I can’t hardcode the mdns IP (http://myha.local) because cast appears not to include mdns lookup here? So I’m stuck trying to get media-source URLs to work…

So, I spent quite a bit trying to figure this out myself. After sitting down with someone else that has a different setup than myself, i’ve narrowed down the reason why chromecast will not play local via media_source on my system:

  1. You need to use an external url, you cannot use an internal url. This limitation is on chromecasts side because it doesn’t trust the source. I.e. HA has to be connected to the internet and it has to use https. I have this set up, however I believe point 2 was blocking me.
  2. If you use a proxy, you may have a bad time. (I didn’t feel like working past this)
  3. Video encoding is a pain. I found an online source below for good video encoding settings that work well in plex (and media_source with your browser as the media_player).

Ultimately, I didn’t feel like troubleshooting my proxy issues. Instead I created a plex server and hosted the videos that way, which I believe is 100% local.

``` Plex video encoding detials ```

I pulled the information from this site: Best HandBrake Settings for Plex (2021 Update)

How to Set HandBrake to Transcode BluRay or DVD Rips for Plex

Below we will show you the best settings for HandBrake to convert DVD/BluRay for later using on Plex.

First of all, open HandBrake and import the source video.

Now, you can start settings:

Go to Summary tab, choose MP4 file as the container format and leave Aligh A/V Start checked.

Best HandBrake settings for Plex

Go to Dimensions, choose Automatic for Cropping and leave other things as default.

Best HandBrake dimension settings for Plex

Filters: no need to make any changes

Under Video tab:
Choose H.264 (x264) for your Video Codec. If your client supports H.265, you can also choose H.265 (x265). H.265 results in smaller file size at the same quality level. Leave the framerate same as source and keep Peak Framerate selected.
Under Optimise Video, drag the Encoder Preset to slower, choose Film for Encoder Tune, choose High for Encoder Profile, and set the Encoder Level to 4.1.
Under Quality, set Constant Quality as RF 18

Best HandBrake video settings for Plex

Under Audio tab:
Choose AAC as the codec
If your movie has a 5.1 channel track, you can mix down the 5.1 Channels. If you are not worried about surround sound, you can just choose Stereo. 160 bitrate is perfectly fine.

Best HandBrake audio settings for Plex

There’s usually no need to adjust the settings of Subtitles and Chapters.

2 Likes

Same for me.

“You need to use an external url, you cannot use an internal url. This limitation is on chromecasts side because it doesn’t trust the source. I.e. HA has to be connected to the internet and it has to use https. I have this set up, however I believe point 2 was blocking me.”
Shouldn’t the media browser integration deal with this? I’m using Nabu Casa and see my Home Mini that was added via the Google Assistant feature. Does the Media Browser work to play music to any speakers other than the web browser?

It does, but many people do not properly set their internal and external url in home assistant and many people don’t use nabucasa.

I have the internal and external addresses set. internal to the IP:8123 and external to Nabu Casa. I just get the ping noise when I try to play from Media Browser. Media Browser lets me select the Mini or the Web Browser.

:man_shrugging: I never got it working and went through the plex route because I’m behind a proxy, don’t use nabucasa, and don’t have hairpinning set up properly.

1 Like

No proxy here. Is the connection from my PI to Nabu Casa cloud to Google cloud to the mini? Seems silly.

Google requires https for casting, you can thank them for that silly requirement.

Is there any way of changing the order of the files listed in the media browser? At the moment I only seem to be able to list them by name. I would like to list them by date with the most recent first.

1 Like

5 months plus… Has anyone found a way to sort by date? (or reverse alphabetical order?

Thanks!

1 Like

this works for me on local browser, google speakers, MPD speaker and SONOS speakers

service: media_player.play_media
data:
  media_content_id: 'media-source://media_source/local/music/Duncan Dhu/01 Cien Gaviotas.mp3'
  media_content_type: music
target:
  device_id: e855eb3e46546f5405f3ab847d78bc6a

all the music is on the media default folder then all artist folders are in a music folder - just look at the path
BTW: the /media/music is a mount folder from my NAS where I’ve all my
music

I am trying to use a picture in customize.yaml from the media browser for entity_picture but can’t figure out the url to use. media-source://media_source/local/icons/my_icon.jpg doesn’t result in illegal logins but doesn’t show the picture. Just about everything else results in illegal logins and ultimately ip bans. Any ideas? I have been able to both write and send camera snapshots as well as play media files so I know the media browser is setup correctly.

I too would like the ability to sort files in the media browser (most recent first). Any idea if or when this will be implemented?

1 Like

Still nothing about this or did i miss something? Would be such a great feature to just press a button in lovelace and get the same popup as in for example the spotify media player card to search media, and not the browser page.

Still no way to sort files in media browser? Would love to see most recent first per default.