Skip to content

Commit

Permalink
fix(camera): resultForVideo uri in iOS13
Browse files Browse the repository at this point in the history
  • Loading branch information
Lamungkun, Sarunyoo committed Feb 14, 2020
1 parent 6feaa95 commit ead75ee
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/ios/CDVCamera.m
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,17 @@ - (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];
NSString* moviePath = [[info objectForKey:UIImagePickerControllerMediaURL] path];

NSArray* spliteArray = [moviePath componentsSeparatedByString: @"/"];
NSString* lastString = [spliteArray lastObject];
NSError *error;
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *documentsDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"tmp"];
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:lastString];
[fileManager copyItemAtPath:moviePath toPath:filePath error:&error];

return [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:filePath];
}

- (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info
Expand Down

0 comments on commit ead75ee

Please sign in to comment.