如何在不使用Android SDK的情况下不使用playUri的情况下获取歌曲元数据? [英] How can I get song metadata without using playUri using the Android SDK?
本文介绍了如何在不使用Android SDK的情况下不使用playUri的情况下获取歌曲元数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从URI中获取歌曲元数据,而不必开始播放/缓冲该歌曲.
I want to get song metadata from a URI without starting to play/buffer that song.
我现在看到的唯一方法是先调用playUri()然后再调用getMetadata(),但我不想立即播放它.
The only way I can see of doing it right now is calling playUri() and then getMetadata() but I don't want to play it immediately.
还有其他方法吗?
谢谢!
是否可以通过SDK处理非本地文件?
Is there a way to do this via the SDK with non-local files?
推荐答案
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
retriever.setDataSource(context, uri);
String artist
= retreiver.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ARTIST);
//etc
retriever.release(); //don't forget to call this when done
这篇关于如何在不使用Android SDK的情况下不使用playUri的情况下获取歌曲元数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文