问题描述
我很难显示来自流媒体源的当前曲目播放.使用MediaMetaDataRetriever类返回NULL,表示失败.我写了一个简单的方法,但是现在我倾向于认为这仅适用于MP3,WMA,AVI等媒体文件.
I am having a tough time displaying the current track playing from a streaming source. Using MediaMetaDataRetriever class returns a NULL, meaning it failed. I wrote a simple method but now I'm inclining to think this only works on media files like MP3, WMA, AVI, etc.
public void metaData(){
mmr.setDataSource(urlStation);
String metaD = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUMARTIST);
Toast.makeText(MainActivity.this, "Artist = " + metaD, Toast.LENGTH_LONG).show();
任何好的和简单的建议将不胜感激.谢谢您的时间!
Any good and easy recommandations would be greatly appreciated. Thank you for your time!
推荐答案
MediaMetadataRetriever不适用于某些Android版本的URL,请参见问题.我创建了 FFmpegMediaMetadataRetriever 作为一种解决方法,建议尝试一下.
MediaMetadataRetriever doesn't work with URL's on certain versions of Android, see this issue. I created FFmpegMediaMetadataRetriever as a workaround, I suggest trying it out.
这篇关于流源上的MediaMetadataRetriever的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!