Send mp3 metadata to car via bluetooth

Post your questions and help other users.

Moderator: Martin

Micky Micky
Posts: 112
Joined: 16 Oct 2019 17:38

Send mp3 metadata to car via bluetooth

Post by Micky Micky » 28 Feb 2020 18:03

Hello,

The mp3 is playing in my own Automagic flow.
I can get the track name and artist from the mp3 file.
I currently announce it in a pop-up notification on my phone and via speech output.
Is there a way of sending it to the car's head unit when connected via bluetooth?

Many thanks

Micky
Crude but it works.

User avatar
Desmanto
Posts: 2599
Joined: 21 Jul 2017 17:50

Re: Send mp3 metadata to car via bluetooth

Post by Desmanto » 01 Mar 2020 18:38

At the speech output, if you choose Audio Stream Type - Music, it should be sending the audio output to the bluetooth device when connected. Or you can try stream - Alarm, it should be sending to both, speaker and bluetooth device.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

ariloc
Posts: 109
Joined: 05 Jun 2016 21:36

Re: Send mp3 metadata to car via bluetooth

Post by ariloc » 04 Mar 2020 03:32

I think you mean to send the metadata of the song playing. I can't test it right now, but I found out that action Send Broadcast can help you.

As it's said in a Stack Overflow thread (Link), it seems you can send a broadcast with metadata changed using (I believe would be) in the Action field, com.android.music.metachanged, and then Extras, something like this:

Code: Select all

putString("artist", artistName);
putString("album", albumName);
putString("track", trackName);
And you should be able to also add in that format, other data as mentioned in the linked thread, like duration of the song. Again, I couldn't test it yet. If I get to do so I'll post back what I got, if I even get that working.

Wibbly
Posts: 358
Joined: 17 Mar 2014 09:02

Re: Send mp3 metadata to car via bluetooth

Post by Wibbly » 04 Mar 2020 09:25

I wonder if this could be used to display other alternative data to the car's head unit?

I could see a use case where music metadata is normally displayed by an app like Spotify, but it is temporarily overwritten by other information when, say, a message is received...

Micky Micky
Posts: 112
Joined: 16 Oct 2019 17:38

Re: Send mp3 metadata to car via bluetooth

Post by Micky Micky » 04 Mar 2020 19:28

Desmanto, you misunderstood me.

Ariloc, you understood me, but that doesn't work.

Wibbly, nice idea. I'm guessing that it's possible.


Thanks everyone for your help.
Crude but it works.

ariloc
Posts: 109
Joined: 05 Jun 2016 21:36

Re: Send mp3 metadata to car via bluetooth

Post by ariloc » 05 Mar 2020 03:39

I'm sorry it doesn't work, but I don't have a device at the moment that supports displaying metadata through Bluetooth. About @Wibbly's idea, it's totally possible. There is an app called Botifier that used to be able to display the notifications from the phone in the car stereo screen, but it's been years since it was last updated and couldn't test it, and also isn't in the Play Store so you have to download it from xda-developers if you want to check if it still works (Botifier). In the Stack Overflow thread I linked before there's another method described in the 2nd comment, but you need to look into using Java with Automagic.
Again, if I get to figure out something, I'll post it as soon as I can.

User avatar
Desmanto
Posts: 2599
Joined: 21 Jul 2017 17:50

Re: Send mp3 metadata to car via bluetooth

Post by Desmanto » 05 Mar 2020 18:29

Sorry, I don't have car yet. Is this head unit running android and can install Automagic? Or it is just like a notification mirroring, maybe like WearOS but can't have any automagic companion on it?
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Micky Micky
Posts: 112
Joined: 16 Oct 2019 17:38

Re: Send mp3 metadata to car via bluetooth

Post by Micky Micky » 06 Mar 2020 21:26

I think it's got Android Auto, but I never bothered with it.
All I'm trying to do is send the track name & artist to the car's head unit.
It's possible because YouTube etc does it.

Not so important now because I deleted my music when I did a factory reset. I also lost all my global variables.

Happy days!
Crude but it works.

Micky Micky
Posts: 112
Joined: 16 Oct 2019 17:38

Re: Send mp3 metadata to car via bluetooth

Post by Micky Micky » 18 Mar 2020 18:07

Hi,

Just use the action - Init Variables Media Metadata

It supplies variables for everything stored in the mp3 if available.

Hope this helps

Micky
Crude but it works.

Wibbly
Posts: 358
Joined: 17 Mar 2014 09:02

Re: Send mp3 metadata to car via bluetooth

Post by Wibbly » 18 Mar 2020 18:39

Micky Micky wrote:
18 Mar 2020 18:07
Hi,

Just use the action - Init Variables Media Metadata

It supplies variables for everything stored in the mp3 if available.

Hope this helps

Micky
Wrong way round I think? That pulls the metadata from an MP3, I want to overwite the metadata the car's head unit is seeing in the MP3 (temorarily)

Post Reply