在 Android 中从 Mp3 检索元数据的最佳方法

发布于 2024-12-21 19:13:14 字数 147 浏览 2 评论 0原文

我一直在为 Android 开发一个小型媒体播放器应用程序。我在从音乐文件检索元数据时遇到一些问题。我一直在使用MediaMetadataRetriever,但事实证明它相当麻烦。有谁知道更好的方法来解决这个问题?如果是这样,如何实现这样的方法?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

躲猫猫 2024-12-28 19:13:14

我使用了 JAudioTagger,您可以在此处找到它。它支持(基本上)ID3 的每个版本,因此即使对于具有过时元数据的旧文件,您也能得到保护。非常好的(而且简单)的解决方案。其他选项包括 mp3agic已标记

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.

花开雨落又逢春i 2024-12-28 19:13:14

我能够从 Android 数据库读取元数据, 使用此处的代码。只需更改 托管查询 类似于:

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

这将光标返回到元数据文件。 (作者、标题、持续时间等)

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.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文