Ionic 3 Camera Plugin Not Returning Video From Photo Library

[Solved] Ionic 3 Camera Plugin Not Returning Video From Photo Library | Swift - Code Explorer | yomemimo.com
Question : Ionic 3 camera plugin not returning video from photo library on ios

Answered by : jeffrey-skinner

//Well the problem is with the apache cordova camera plugin it provides the temporary path to the video file to come out from this error implement below changes in camera plugin.
//in CDVCamera.m change THIS:
(CDVPluginResult*)resultForVideo:(NSDictionary*)info
{
NSString* moviePath = [[info objectForKey:UIImagePickerControllerMediaURL] absoluteString];
return [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:filePath];
}
//to THIS:
(CDVPluginResult*)resultForVideo:(NSDictionary*)info
{
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];
}

Source : | Last Update : Thu, 24 Sep 20

Answers related to ionic 3 camera plugin not returning video from photo library on ios

Code Explorer Popular Question For Swift