[英]UIImagePickerController with camera source: video trimming doesn't work
[英]UIImagePickerController with camera source with allows editing yes : video trimming doesn't work
我正在使用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];
}
我想根据我的应用程序使用修剪过的视频进行进一步处理。
我哪里错了?
有没有其他方法可以完成这项任务?
allowsEditing :一个布尔值,指示是否允许用户编辑选定的静止图像或影片。
@property(nonatomic)BOOL允许编辑
讨论如果您允许用户编辑静止图像或电影,则代理可能会收到一个字典,其中包含有关所做编辑的信息。 UIImagePickerControllerDelegate协议参考中描述了委托的协议。
我认为这会有所帮助。
你需要从 - (void)imagePickerController中获取信息[UIImagePickerControllerEditedImage] :( UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
我相信。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.