开发者

Android - Reading ID3 tags from mp3 stream

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?


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.


this is a opensouce project maybe can help you,http://www.jthink.net/jaudiotagger/index.jsp

Jaudiotagger is not the only Java tagging library available, but does have some key benefits you might like to consider in evaluating a library to use

Provide a generic interface for the most popular thirty attributes for all the fully supported formats Supports reading and writing of mp4,m4a and mp4p (protected) files, including multiple images and reverse dns fields Supports Multiple Page Ogg Vorbis Comments Supports MP3 ID3v1,ID3v11, ID3v2.2, v2.3 and v2.4 are transparently Allows easy conversion between ID3 tag versions Supports Flac, including embedded and linked image support Provides proper object representations of most fields, rather than a simple byte representation Fully supports Unicode Text Encoding Is being actively developed and supported Uses an automatic testsuite to ensure code compatibility betweens versions Uses a Code Coverage tool to ensure code is actually being tested Is being used by a number of applications

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜