java - MediaMetadataRetrieverJNI: getEmbeddecPicture failed -


im using android , iterating on few hundred mediafiles find first embedded picture, works well, sends me lot of errors in logcat.

im using code:

for (string s : arraylist <string> paths){     mediametadataretriever mmr = new mediametadataretriever();     mmr.setdatasource(path);     byte[] data = mmr.getembeddedpicture();     if (data != null) {     ... } 

the error logs is:

e/mediametadataretrieverjni﹕ getembeddedpicture: call getembeddedpicture failed. e/mediametadataretrieverjni﹕ getembeddedpicture: call getembeddedpicture failed. e/mediametadataretrieverjni﹕ getembeddedpicture: call getembeddedpicture failed. e/mediametadataretrieverjni﹕ getembeddedpicture: call getembeddedpicture failed. e/mediametadataretrieverjni﹕ getembeddedpicture: call getembeddedpicture failed. e/mediametadataretrieverjni﹕ getembeddedpicture: call getembeddedpicture failed. ..... 

am using right? if can suppress error, makes debugging annoying. according mediametadataretriever should return null

using getembeddedpicture not enough need add little bit code that.

try this

md.setdatasource(songslist.get(index).get("songpath")); byte[] artbytes =  mmr.getembeddedpicture(); if(artbytes != null) {     inputstream = new bytearrayinputstream(mmr.getembeddedpicture());     bitmap bm = bitmapfactory.decodestream(is);     imgart.setimagebitmap(bm); } else {     imgart.setimagedrawable(getresources().getdrawable(r.drawable.your_default_image)); } 

also @ this:

try {         byte [] art = md.getembeddedpicture();         bitmap songimage = bitmapfactory             .decodebytearray(art, 0, art.length);         md.extractmetadata(mediametadataretriever.metadata_key_album));         string artist =md.extractmetadata(mediametadataretriever.metadata_key_artist));         string genre = md.extractmetadata(mediametadataretriever.metadata_key_genre));     } catch (exception e) {          // to-do exception     } 

refer docs


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -