Getting Meta Data from Audio Stream

I have been looking into an easy way to read the audio media data from a web radio stream, in order to show the “now playing” information, if that is available.

Moreover, I would also like to have a working solution that basically listens to the metadata, so that the “now playing” info is updated when the song changes in the stream.

Anyone has any hints or experience with this? I’m afraid my searches didn’t yield any results…

I already wrote my own streaming Service, which makes use of these imports:

import { MusicControls } from ‘@ionic-native/music-controls’;
import { Media, MediaObject } from ‘@ionic-native/media’;

Thanks!

Trying another shout-out for help… I would appreciate it if someone could point me to a plug-in that would work for an Android app… Thanks!

Any luck with this yet? With MP3s you want to read the ID3 tag data…try something like this, or theres plenty of code out there on getting ID3 tag metadata Not sure about radio streams though. https://github.com/aadsm/JavaScript-ID3-Reader.

So far no luck. I reached out on StackOverflow as well with this question, after I found some Icy request code that I thought could be used.

Please see here: Parsing metadata from audio icy

But I haven’t gotten a conclusive answer. I doubt reading the mp3 ID3 tags will help here, since the streaming files are in different format.

I managed to solve this for IceCast and ShoutCast streams by retrieving the status json or html data from the streaming service, and parsing the data with dedicated functions.

Hello! I’m trying to get metadata from icecast stream. Could You explain how did you make it, pls?

A) For SHOUTcast servers:

Make a fetch request to the “7.html” file on the streaming server. The “7.html” file should be located on the root of the streaming URL, e.g.:

http://yourstreamingserver:port/7.html

The content of the file looks like this:

5,1,19,100,5,128,Bruce Springsteen - Atlantic City

It contains the data about the number of listeners, max number of listeners, peak listeners, stereo or mono bitrate, and then finally the most important: the current track name / artist information.

This info can be extracted by splitting up the string data based on the “,” and “-” characters.

B) For IceCast servers:

The file to look for in this case is called “status-json.xsl”, or in some cases it’s called “current.json”. I suppose there are other variations as well. You will need to do find that out.

It’s a JSON file, that you can fetch, and extract the data from.

C) Others:

  • I’ve also come across streaming servers that offer a plain “txt” file, at least that is what the file extension says. But the content is HTML. Again, a parsing function works just fine, if you know the structure of the response data.

  • E.g.: https://public.radio.co/stations/s53b48cf54/status --> JSON

There are multiple variations. Hope these tips help you in your project!