I am trying to get an album cover in MP3 format. I thought the best and cleanest way to do this is to use the MediaMetadataRetriever class. But for some reason, calling the getEmbeddedPicture method does not work. The image is not displayed, LogCat shows an error:
04-29 18:36:19.520: E/MediaMetadataRetrieverJNI(25661): getEmbeddedPicture: Call to getEmbeddedPicture failed.
This is the code that does not seem to work:
@Override
protected Void doInBackground(Void... params) {
MediaMetadataRetriever mmdr = new MediaMetadataRetriever();
mmdr.setDataSource(path);
bites = mmdr.getEmbeddedPicture();
if(bites != null)
artBM = BitmapFactory.decodeByteArray(bites, 0, bites.length);
return null;
}
I run it on a device with Android 4.2, so there should not be any problems with MediaMetadataRetriever (api lvl 10 required). The files I tested show an image in Windows Explorer, so it seems to be an embedded art. Anyone have any thoughts on this?
source
share