1

This is a bit out of my realm, so I'm hoping for some help. I'm trying to help a friend who has setup an audio stream(via StationPlayList) to play music, and then he as a fairly simple webpage where he broadcasts the stream through an <audio> tag on the website.

When he goes to the website on his phone and connects it to the bluetooth in his car, it doesn't show the correct song info (Album/Title/Artist). It pulls the title off the webpage for song name, and the URL of the webpage for the artist.

Is there anyway to accomplish showing the correct info? The software he uses does have the ability to upload a file to a server anytime the song changes, I'm just not sure what I would need to do with it to make this work. Any ideas??

Thanks!

Brad
  • 159,648
  • 54
  • 349
  • 530
k_hack
  • 11
  • 2

1 Answers1

0

You can use the MediaSession API for this.

navigator.mediaSession.metadata = new MediaMetadata({
  title: 'This is a title!!',
  artist: 'Artist Name',
  album: 'Some Album',
  artwork: [{src: 'cover.jpg'}]
});
Brad
  • 159,648
  • 54
  • 349
  • 530
  • Thanks for the response! I did find that last night and have experimented with it a bit and it seems like it should do the trick for displaying the info correctly over bluetooth. I'm not sure yet how I'm going to extract the metadata info to display using the MediaSesson api though. I'm thinking of adding a script that reads from a file every 20 seconds or so to get the data and updates it there, if his software truly can upload a new file every time the song changes. – k_hack May 20 '20 at 18:36