Android - Reading ID3 tags from mp3 stream

duessi picture duessi · Jan 18, 2010 · Viewed 10.2k times · Source

I'm streaming an mp3 file using MediaPlayer

mp.setDataSource(myContext, Uri.parse("http://my_song.mp3"));  
mp.prepareAsync();  
mp.setOnPreparedListener(mpOnPreparedListener);  
mp.setOnBufferingUpdateListener(mpOnBufferingUpdateListener);  

Any idea about how I can read the ID3 tags from this stream using android API or any alternative methods?

Answer

RajSharma picture RajSharma · Aug 16, 2015

You can get all of this using MediaMetadataRetriever

MediaMetadataRetriever mmr = new MediaMetadataRetriever();
mmr.setDataSource(filePath);   

String albumName = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUM);

you can get all other tags by using this class. I hope this would help you.