steven0529
steven0529

Reputation: 1563

Android - How to get metadata from a live audio stream/internet radio channel using url

I am currently working on a music streaming/internet radio Android app, I really would appreciate if you could help me on this. Thanks in advance!

I can play the music but I dont know how to get information such as currently playing song,album art,etc. It would really help my app if I can get these information.

My question is, how would I know or where would I get the info on what song is currently playing? As I have noticed VLC can do it with given only a link.

Here is a screenshot from vlc.

enter image description here enter image description here

Here are couple of links that I have tried:

http://tar.stream.dev.al:9078/listen.pls

http://84.46.147.81:80/m1/mp3

http://stream.radioeger.hu:18000/listen.pls

http://95.110.186.253:8020/magic.mp3

Upvotes: 1

Views: 6966

Answers (2)

Mark Meyer
Mark Meyer

Reputation: 11

Most radio streams use http streaming. The compressed audio data is usually interleaved with metadata. So you will need a way to process the http stream in realtime, extracting any metadata. For Shoutcast, the metadata is part of the protocol, here is an example from streamripper:

http://streamripper.cvs.sourceforge.net/viewvc/streamripper/streamripper/ripper.c?revision=1.1.1.1&view=markup

For classic HTTP streaming, the protocol does not include metadata, but the container does. In this case you also have to rudimentarily decode the container. Again here's an example from streamripper. This one uses libvorbis to inspect the container and get the metadata. It does however have to do some magic tricks to get it right:

http://streamripper.cvs.sourceforge.net/viewvc/streamripper/sripper_1x/lib/ripogg.c?revision=1.22&view=markup

HTH

Upvotes: 1

Md Abdul Gafur
Md Abdul Gafur

Reputation: 6201

you able to retrieve audio metadata via MediaMetadataRetriever but MediaMetadataRetriever doesn't work with URL's on certain versions of Android. so, Use FFmpegMediaMetadataRetriever as a workaround, I suggest trying it out.

Upvotes: 3

Related Questions