简体   繁体   中英

UIImagePickerController with camera source: video trimming doesn't work

I am using UIImagePickerController to record a video with the sourceType set to UIImagePickerControllerSourceTypeCamera .

I have set allowsEditing to true so that the video can be edited before the picker returns. But after I edit the video using the trimming interface and press "Pick", I only get back the original recording in the delegate, not the trimmed version. What am I doing wrong? I am using iPhone OS 3.1.3. I remember this used to work in an earlier version but it seems to be failing in the latest OS. Any help is appreciated?

By the way i confirmed that if the source of the video is UIImagePickerControllerSourceTypeSavedPhotosAlbum , the trimming works in version 3.1.3. So trimming with source as the camera is failing. Interestingly with the camera-roll/photos-album as the source, a "Choose" button appears and soon after clicking it, the controller displays a message saying the "Video is being trimmed ... ". I don't get this message when using the camera source.

Here is a snippet of the code I am using to record a video using the camera source.

- (void) recordVideo {
   UIImagePickerController *picker = [[UIImagePickerController alloc] init];
   picker.delegate = self;
   picker.allowsEditing = YES;
   picker.sourceType = UIImagePickerControllerSourceTypeCamera;
   picker.mediaTypes =  [NSArray arrayWithObject:(NSString *)kUTTypeMovie];
   picker.videoQuality = UIImagePickerControllerQualityTypeHigh;

   [self presentModalViewController:picker animated:YES];
   [picker release];   
}

My delegate implementation is as follows:

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

  [picker dismissModalViewControllerAnimated:YES];
  self.videoPath = [[info objectForKey:UIImagePickerControllerMediaURL] path];
  ...
}

Thanks a lot,

kris.

Just ran into this myself ... and found this post when looking for a solution.

looks like the only way around this is to copy the file to your app's directory, then open the UIVideoEditorController ...

Anyone know if this UIImagePickerController newly-captured video not being trimmed issue is a bug in the SDK, or are we doing something wrong?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM