Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
525 views
in Technique[技术] by (71.8m points)

android - MediaMetadataRetriever on streaming source

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!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...