简体   繁体   English

带摄像头源的UIImagePickerController:视频修剪不起作用

[英]UIImagePickerController with camera source: video trimming doesn't work

I am using UIImagePickerController to record a video with the sourceType set to UIImagePickerControllerSourceTypeCamera . 我正在使用UIImagePickerController来记录sourceType设置为UIImagePickerControllerSourceTypeCamera的视频。

I have set allowsEditing to true so that the video can be edited before the picker returns. 我已将allowsEditing设置为true,以便在选择器返回之前编辑视频。 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. 我正在使用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. 顺便说一下,我确认如果视频的来源是UIImagePickerControllerSourceTypeSavedPhotosAlbum ,则修剪工作在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 ... 看起来唯一的办法是将文件复制到你的应用程序目录,然后打开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? 任何人都知道这个UIImagePickerController新捕获的视频是否被修剪问题是SDK中的错误,还是我们做错了什么?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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