fix: RuntimeException on faulty video files (#241)

fixes #239
This commit is contained in:
Mik 2020-10-07 05:30:21 +02:00 committed by GitHub
parent 39cc3b0fbc
commit a83ad4c14e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -619,7 +619,11 @@ public class CameraRollModule extends ReactContextBaseJavaModule {
if (photoDescriptor != null) {
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
retriever.setDataSource(photoDescriptor.getFileDescriptor());
try {
retriever.setDataSource(photoDescriptor.getFileDescriptor());
} catch (RuntimeException e) {
// Do nothing. We can't handle this, and this is usually a system problem
}
try {
int timeInMillisec =
Integer.parseInt(
@ -683,7 +687,11 @@ public class CameraRollModule extends ReactContextBaseJavaModule {
if (photoDescriptor != null) {
if (isVideo) {
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
retriever.setDataSource(photoDescriptor.getFileDescriptor());
try {
retriever.setDataSource(photoDescriptor.getFileDescriptor());
} catch (RuntimeException e) {
// Do nothing. We can't handle this, and this is usually a system problem
}
try {
width =
Integer.parseInt(