catch some more exception when retrieving media runtime
This commit is contained in:
parent
a37f7478e6
commit
f4638d7eec
|
@ -809,7 +809,7 @@ public class FileBackend {
|
||||||
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
|
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
|
||||||
mediaMetadataRetriever.setDataSource(mXmppConnectionService,uri);
|
mediaMetadataRetriever.setDataSource(mXmppConnectionService,uri);
|
||||||
return Integer.parseInt(mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION));
|
return Integer.parseInt(mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION));
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (RuntimeException e) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -840,7 +840,7 @@ public class FileBackend {
|
||||||
try {
|
try {
|
||||||
metadataRetriever.setDataSource(file.getAbsolutePath());
|
metadataRetriever.setDataSource(file.getAbsolutePath());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new NotAVideoFile();
|
throw new NotAVideoFile(e);
|
||||||
}
|
}
|
||||||
return getVideoDimensions(metadataRetriever);
|
return getVideoDimensions(metadataRetriever);
|
||||||
}
|
}
|
||||||
|
@ -907,7 +907,13 @@ public class FileBackend {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class NotAVideoFile extends Exception {
|
private static class NotAVideoFile extends Exception {
|
||||||
|
public NotAVideoFile(Throwable t) {
|
||||||
|
super(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public NotAVideoFile() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class FileCopyException extends Exception {
|
public class FileCopyException extends Exception {
|
||||||
|
|
Loading…
Reference in a new issue