Android MediaMetadataRetriever returns null values from most keys

北城余情 提交于 2019-12-09 02:28:11

问题


I want to get information out of my media files (mp3 mostly) and I get only null from those values I want. I have tried all keys for extractMetadata(key). Am I skipping/missing something?

Code basis:

MediaMetadataRetriever f = new MediaMetadataRetriever();
f.setDataSource(item.getFilePath());

String title = f.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE);

I do get correct values with the duration key (MediaMetadataRetriever.METADATA_KEY_DURATION) and mimetype key (MediaMetadataRetriever.METADATA_KEY_MIMETYPE), which indicates that the datasource/filepath is working.

Poweramp (popular media player) is able to read metadata values, like title/author/composer etc. since it displays these extra values in the UI. Or perhaps Poweramp gets these values from some other source or method?

Any help is appreciated.


回答1:


This may sound silly but have you tried with many different mp3 files? Just with my experience if you get your mp3 files illegally the keys sometimes just aren't there.




回答2:


Poweramp maintains its own database in /data/data/com.maxmpz.audioplayer/databases/folders.db You will need a rooted device to investigate this database. You can send me a pm if you want more details




回答3:


The meta data value associate with the given keyCode on success; null on failure.



来源:https://stackoverflow.com/questions/12465915/android-mediametadataretriever-returns-null-values-from-most-keys

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