带摄像头源的UIImagePickerController允许编辑是:视频修剪不起作用 [英] UIImagePickerController with camera source with allows editing yes : video trimming doesn't work
问题描述
我正在使用 UIImagePickerController
来录制一个视频,其sourceType设置为 UIImagePickerControllerSourceTypeCamera
。
I am using UIImagePickerController
to record a video with the sourceType set to UIImagePickerControllerSourceTypeCamera
.
我已将 allowsEditing
设置为true。
I have set allowsEditing
to true.
捕获视频后,我编辑了视频使用修剪界面并按使用,我只回到原始记录而不是修剪版本。我做错了什么?
After capturing video I edit the video using the trimming interface and press "Use", I only get back the original recording not the trimmed version. What am I doing wrong?
我使用的是iOS 5.
I am using iOS 5.
-(void)shootvideo {
imagePicker = [[UIImagePickerController alloc] init];
[imagePicker.view addSubview:test];
[imagePicker.view addSubview:test2];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.mediaTypes = [[NSArray alloc] initWithObjects:(NSString *)kUTTypeMovie, nil];
imagePicker.showsCameraControls = YES;
imagePicker.navigationBarHidden = NO;
imagePicker.toolbarHidden = NO;
imagePicker.wantsFullScreenLayout = YES;
imagePicker.allowsEditing=YES;
[self presentModalViewController:imagePicker animated:YES];
}
-(void) imagePickerController: (UIImagePickerController *) picker
didFinishPickingMediaWithInfo: (NSDictionary *) info
{
NSString *mediaType = [info objectForKey: UIImagePickerControllerMediaType];
if (CFStringCompare ((__bridge CFStringRef) mediaType, kUTTypeMovie, 0)
== kCFCompareEqualTo)
{
NSString *moviePath = [[info objectForKey:UIImagePickerControllerMediaURL] path];
//NSLog(@"%@",moviePath);
if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum (moviePath)) {
UISaveVideoAtPathToSavedPhotosAlbum (moviePath, nil, nil, nil);
}
}
[self dismissModalViewControllerAnimated:YES];
}
我想根据我的应用程序使用裁剪后的视频进行进一步处理。
I want to use that trimmed video for further processing according to my application.
我哪里出错?
还有其他办法可以完成这项任务吗?
Is there any other way to achieve this task?
推荐答案
你需要从 - (void)imagePickerController中获取信息[UIImagePickerControllerEditedImage] :( UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
you need to grab the info[UIImagePickerControllerEditedImage] from the - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
我相信。
这篇关于带摄像头源的UIImagePickerController允许编辑是:视频修剪不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!