Work around Android 5 returning 'null' duration for opus files (#7440)
This commit is contained in:
parent
993a1eb171
commit
4990d95f33
|
@ -194,6 +194,7 @@ public class LocalFeedUpdater {
|
||||||
try {
|
try {
|
||||||
loadMetadata(item, file, context);
|
loadMetadata(item, file, context);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
item.setDescriptionIfLonger(e.getMessage());
|
item.setDescriptionIfLonger(e.getMessage());
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
|
@ -222,7 +223,9 @@ public class LocalFeedUpdater {
|
||||||
}
|
}
|
||||||
|
|
||||||
String durationStr = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);
|
String durationStr = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);
|
||||||
|
if (durationStr != null && !durationStr.equals("null")) {
|
||||||
item.getMedia().setDuration((int) Long.parseLong(durationStr));
|
item.getMedia().setDuration((int) Long.parseLong(durationStr));
|
||||||
|
}
|
||||||
|
|
||||||
item.getMedia().setHasEmbeddedPicture(mediaMetadataRetriever.getEmbeddedPicture() != null);
|
item.getMedia().setHasEmbeddedPicture(mediaMetadataRetriever.getEmbeddedPicture() != null);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue