有没有办法在 Android 上获取歌曲播放次数/最近播放的歌曲?

发布于 2024-12-03 07:56:42 字数 201 浏览 1 评论 0原文

我想知道是否有任何方法可以访问 Android 上最常播放/最近播放的歌曲或歌曲的播放次数?我尝试过使用 MediaStore 从内容解析器获取信息,但没有找到任何内容。虽然里面有很多东西,所以我可能错过了一些东西。我还查看了 MediaMetadataRetriever,但我也看不到任何内容。查看维基百科显示 ID3v2 标签可以包含播放计数器,但这可以通过 Android 访问吗?

I'm wondering if there's any way to access the top played/recently played songs, or play counts for songs on Android? I've had a look at getting information from a content resolver using the MediaStore, but I haven't found anything. There's a lot in there though, so I may have missed something. I've also looked at MediaMetadataRetriever, but I can't see anything there either. Looking at Wikipedia shows that ID3v2 tags can contain a play counter, but is this accessible through Android?

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

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

发布评论

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

评论(2

天涯沦落人 2024-12-10 07:56:42

这里有一个链接,说应该可以使用 id3标签库。

FrameBodyPCNT 是您需要使用 id3 标签库中的播放计数器类。

Here is a link that says it should be possible using the id3 tag library.

The FrameBodyPCNT is the play counter class you need use from the id3 tag library.

喜爱皱眉﹌ 2024-12-10 07:56:42

作为部分答案,我在玩这个时确实有一个想法,使用 lastModified() 方法(因为我将所有歌曲作为 File 进行浏览)无论如何)。这个功能实际上最终被废弃了,所以我没有测试它,但是使用 lastModified() 并获取那些具有最高值的歌曲应该会给你最新播放/添加的歌曲(正如我'我猜测每次播放时 ID3 标签都会略有改变,特别是当有播放计数器时)。

不过,我会再等一段时间,看看其他人是否能提出一些建议。

As a partial answer, I did have an idea while I was playing around with this, to use the lastModified() method (as I was going through all the songs as Files anyway). This functionality actually got scrapped in the end, so I didn't test it, but using lastModified() and taking those songs with the highest value should give you the latest played/added songs (as I'm guessing the ID3 tags would be slightly altered with each play, especially as there is the play counter).

However, I'm going to wait a little longer to see if anyone else comes up with something.

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