安卓类MediaMetadataRetriever大多数键返回空值安卓类、MediaMetadataRetriever

2023-09-09 21:00:43 作者:囿尓、狠緈諨

我想获取信息的媒体文件(MP3居多),我得到我想要的值仅空。我已经试过了所有密钥extractMetadata(键)。我是否跳过/失去了一些东西?

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依据:

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

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

我得到正确的价值观与持续时间的关键(MediaMetadataRetriever.METADATA_KEY_DURATION)和MIMETYPE键(MediaMetadataRetriever.METADATA_KEY_MIMETYPE),这表明数据源/文件路径工作正常。

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?

任何帮助是AP preciated。

Any help is appreciated.

推荐答案

这听起来可能很傻,但你尝试过许多不同的MP3文件?只是凭我的经验,如果你非法获取你的MP3文件中的键有时只是不存在。

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.