Page 1 of 2
Send mp3 metadata to car via bluetooth
Posted: 28 Feb 2020 18:03
by Micky Micky
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
Re: Send mp3 metadata to car via bluetooth
Posted: 01 Mar 2020 18:38
by Desmanto
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.
Re: Send mp3 metadata to car via bluetooth
Posted: 04 Mar 2020 03:32
by ariloc
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.
Re: Send mp3 metadata to car via bluetooth
Posted: 04 Mar 2020 09:25
by Wibbly
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...
Re: Send mp3 metadata to car via bluetooth
Posted: 04 Mar 2020 19:28
by Micky Micky
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.
Re: Send mp3 metadata to car via bluetooth
Posted: 05 Mar 2020 03:39
by ariloc
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.
Re: Send mp3 metadata to car via bluetooth
Posted: 05 Mar 2020 18:29
by Desmanto
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?
Re: Send mp3 metadata to car via bluetooth
Posted: 06 Mar 2020 21:26
by Micky Micky
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!
Re: Send mp3 metadata to car via bluetooth
Posted: 18 Mar 2020 18:07
by Micky Micky
Hi,
Just use the action - Init Variables Media Metadata
It supplies variables for everything stored in the mp3 if available.
Hope this helps
Micky
Re: Send mp3 metadata to car via bluetooth
Posted: 18 Mar 2020 18:39
by Wibbly
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)