开发者

UIImagePickerController with camera source: video trimming doesn't work

开发者 https://www.devze.com 2022-12-19 06:05 出处:网络
I am using UIImagePickerController to record a video with the sourceType set to UIImagePickerControllerSourceTypeCamera.

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消