Best Way to Retrieve MetaData from Mp3s In Android

我的梦境 提交于 2019-12-23 13:09:44

问题


I've been working on a small media player app for Android. I'm having some trouble retrieving the meta data from the music files. I've been using the MediaMetadataRetriever, but it has proved to be quite troublesome. Does anyone know of a better way to go about this? If so how would one implement such method?


回答1:


I've used JAudioTagger, which you can find here. It supports (basically) every version of ID3, so you're covered even for old files with outdated metadata. Pretty good (and easy) solution. Other options include mp3agic and entagged.




回答2:


I was able to read the metadata from the Android database, using the code here. Just change the managedquery to something like:

String selection = MediaStore.Audio.Media.DATA + " == ?";
cursor = this.managedQuery(media,
                        projection,
                        selection,
                        new String[] {file.getCanonicalPath().toString()},
                        null);

This returns a cursor to the metadata of file. (Author, Title, duration etc.)



来源:https://stackoverflow.com/questions/8542519/best-way-to-retrieve-metadata-from-mp3s-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!