0

I was wondering if there is a way how can I get the cover photo of a song while playing it on MediaPlayer. Every song is directly streamed from the internet but I know that MediaPlayer is temporally saving it on Device.

I know about MediaMetadataRetriever but I don't think it will work in my case.

Marian Pavel
  • 2,726
  • 8
  • 29
  • 65

1 Answers1

2

MediaMetadataRetriever's getEmbeddedPicture may be of help for you. Refer this . Also, getArtwork() method in the code of android platform music player maybe of some help.

Use the below snippet to set the data source for your MediaMetadataRetrieverObject. where link is the url of your file. This is hould be done before calling getArtwork().

     if (Build.VERSION.SDK_INT >= 14)
        MediaMetadataRetrieverObject.setDataSource(link, new HashMap<String, String>());
     else
        MediaMetadataRetrieverObject.setDataSource(link);
Community
  • 1
  • 1
harshitpthk
  • 4,058
  • 2
  • 24
  • 32