mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2024-12-22 22:28:10 +01:00
Made sure that fallback URL is used if MMR fails
This commit is contained in:
parent
99068c82cc
commit
40ef24d8ad
@ -76,19 +76,11 @@ public class PicassoProvider {
|
||||
|
||||
private static class MediaRequestHandler extends RequestHandler {
|
||||
|
||||
final MediaMetadataRetriever mmr;
|
||||
final Context context;
|
||||
|
||||
public MediaRequestHandler(Context context) {
|
||||
super();
|
||||
this.context = context;
|
||||
mmr = new MediaMetadataRetriever();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
super.finalize();
|
||||
mmr.release();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -99,11 +91,22 @@ public class PicassoProvider {
|
||||
@Override
|
||||
public Result load(Request data) throws IOException {
|
||||
Bitmap bitmap = null;
|
||||
mmr.setDataSource(data.uri.getPath());
|
||||
byte[] image = mmr.getEmbeddedPicture();
|
||||
if (image != null) {
|
||||
bitmap = decodeStreamFromByteArray(data, image);
|
||||
MediaMetadataRetriever mmr = null;
|
||||
try {
|
||||
mmr = new MediaMetadataRetriever();
|
||||
mmr.setDataSource(data.uri.getPath());
|
||||
byte[] image = mmr.getEmbeddedPicture();
|
||||
if (image != null) {
|
||||
bitmap = decodeStreamFromByteArray(data, image);
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
Log.e(TAG, "Failed to decode image in media file", e);
|
||||
} finally {
|
||||
if (mmr != null) {
|
||||
mmr.release();
|
||||
}
|
||||
}
|
||||
|
||||
if (bitmap == null) {
|
||||
// check for fallback Uri
|
||||
String fallbackParam = data.uri.getQueryParameter(PicassoImageResource.PARAM_FALLBACK);
|
||||
|
Loading…
Reference in New Issue
Block a user