我正在使用UIImagePickerController
来录制sourceType设置为UIImagePickerControllerSourceTypeCamera
的视频。
我已将allowsEditing
设为true。
拍摄视频后,我使用剪裁界面编辑视频并按“使用”,我只返回原始记录而不是修剪版本。我做错了什么?
我正在使用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];
}
我想根据我的应用程序使用修剪后的视频进行进一步处理。
我哪里错了?
还有其他方法可以完成这项任务吗?
答案 0 :(得分:0)
allowsEditing :一个布尔值,指示是否允许用户编辑选定的静止图像或电影。
@property(nonatomic)BOOL allowEditing
<强>讨论强> 如果您允许用户编辑静止图像或电影,则代理可能会收到一个字典,其中包含有关所做编辑的信息。委托的协议在UIImagePickerControllerDelegate Protocol Reference.
中描述我认为这会有所帮助。
答案 1 :(得分:0)
你需要从 - (void)imagePickerController中获取信息[UIImagePickerControllerEditedImage] :( UIImagePickerController *)选择器didFinishPickingMediaWithInfo:(NSDictionary *)info
我相信。