From 6f06bef0fdadf0f30cb4a3a5b629ff0ddd55900b Mon Sep 17 00:00:00 2001 From: guillem Date: Sat, 18 Jan 2020 11:58:52 +0100 Subject: [PATCH 1/3] fix(ios): handle video transcoding cancel exception --- src/ios/CDVCamera.m | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ios/CDVCamera.m b/src/ios/CDVCamera.m index 1dca07ca6..fb04c6af1 100644 --- a/src/ios/CDVCamera.m +++ b/src/ios/CDVCamera.m @@ -512,8 +512,13 @@ - (void)resultForImage:(CDVPictureOptions*)options info:(NSDictionary*)info comp - (CDVPluginResult*)resultForVideo:(NSDictionary*)info { - NSString* moviePath = [[info objectForKey:UIImagePickerControllerMediaURL] absoluteString]; - return [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:moviePath]; + @try { + NSString* moviePath = [[info objectForKey:UIImagePickerControllerMediaURL] absoluteString]; + return [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:moviePath]; + } @catch (NSException *exception) { + NSLog(@"Camera.resultForVideo: error retrieving file path"); + return [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@""]; + } } - (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info From 6dce381d5feee715600926fbc9589b52ceba9810 Mon Sep 17 00:00:00 2001 From: guillem Date: Sun, 12 Apr 2020 12:47:54 +0200 Subject: [PATCH 2/3] fix(resultForVideo): pass exception message to cordova callback --- src/ios/CDVCamera.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ios/CDVCamera.m b/src/ios/CDVCamera.m index fb04c6af1..a4e388fde 100644 --- a/src/ios/CDVCamera.m +++ b/src/ios/CDVCamera.m @@ -516,8 +516,8 @@ - (CDVPluginResult*)resultForVideo:(NSDictionary*)info NSString* moviePath = [[info objectForKey:UIImagePickerControllerMediaURL] absoluteString]; return [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:moviePath]; } @catch (NSException *exception) { - NSLog(@"Camera.resultForVideo: error retrieving file path"); - return [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@""]; + NSLog(@"Camera.resultForVideo: error retrieving file path. Original exception: %@: %@", exception.name, exception.reason); + return CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:[@"%@: %@", exception.name, exception.reason]; } } From 9b6643050db4f08db13e4fd7cc2818dc81a39c92 Mon Sep 17 00:00:00 2001 From: guillem Date: Sun, 12 Apr 2020 13:45:01 +0200 Subject: [PATCH 3/3] fix(resultForVideo): expection reason --- src/ios/CDVCamera.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ios/CDVCamera.m b/src/ios/CDVCamera.m index a4e388fde..41e385e96 100644 --- a/src/ios/CDVCamera.m +++ b/src/ios/CDVCamera.m @@ -516,8 +516,8 @@ - (CDVPluginResult*)resultForVideo:(NSDictionary*)info NSString* moviePath = [[info objectForKey:UIImagePickerControllerMediaURL] absoluteString]; return [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:moviePath]; } @catch (NSException *exception) { - NSLog(@"Camera.resultForVideo: error retrieving file path. Original exception: %@: %@", exception.name, exception.reason); - return CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:[@"%@: %@", exception.name, exception.reason]; + NSLog(@"Camera.resultForVideo: error retrieving file path"); + return [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:[exception reason]]; } }