7

我正在使用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];  
}

我想根据我的应用程序使用该修剪后的视频进行进一步处理。

我哪里错了?

有没有其他方法可以完成这项任务?

4

2 回答 2

0

allowsEditing : A Boolean value indicating whether the user is allowed to edit a selected still image or movie.

@property (nonatomic) BOOL allowsEditing

Discussion If you allow the user to edit still images or movies, the delegate may receive a dictionary with information about the edits that were made. The protocol for the delegate is described in UIImagePickerControllerDelegate Protocol Reference.

I Think this will be helpful.

于 2012-09-18T09:12:01.583 回答
0

您需要从 - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info 中获取 info[UIImagePickerControllerEditedImage]

我相信。

于 2014-08-21T18:54:25.453 回答