[英]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.