I have implemented a UIImagePickerController in my application with a videoMaximumDuration of 10 seconds.
However in the callback from the delegate imagePickerController:didFinishPickingMediaWithInfo: in the NSDictionary i can only retrieve the original video (and not the trimmed video) from the PHAsset.
NSLog from the dictionary when i choose a video.
info: {
UIImagePickerControllerMediaType = "public.movie";
UIImagePickerControllerPHAsset = "<PHAsset: 0x1149af010> E2FA31C6-0232-4A89-8DE5-A4C8CBC98D97/L0/001 mediaType=2/0, sourceType=1, (540x960), creationDate=2019-06-05 14:01:07 +0000, location=0, hidden=0, favorite=0 ";
UIImagePickerControllerReferenceURL = "assets-library://asset/asset.mov?id=E2FA31C6-0232-4A89-8DE5-A4C8CBC98D97&ext=mov";
}
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
if([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeSavedPhotosAlbum])
{
picker.delegate = self;
picker.allowsEditing = YES;
picker.videoMaximumDuration = 10.0f;
picker.modalPresentationStyle = UIModalPresentationCurrentContext;
picker.mediaTypes = @[(NSString*)kUTTypeMovie, (NSString*)kUTTypeAVIMovie, (NSString*)kUTTypeVideo, (NSString*)kUTTypeMPEG4, (NSString*)kUTTypeImage];
picker.videoQuality = UIImagePickerControllerQualityTypeHigh;
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
[self._viewCtrl presentViewController:picker animated:YES completion:nil];
}
How can i access the trimmed video ? Thank
I don't know why but changing UIImagePickerControllerSourceTypeSavedPhotosAlbum
by UIImagePickerControllerSourceTypePhotoLibrary
fixed it (now show UIImagePickerControllerMediaURL
in the NSSDictionary)