2012-05-20 5 views
7

UIImagePickerControllerを使用して、sourceTypeをUIImagePickerControllerSourceTypeCameraに設定してビデオを録画しています。UIImagePickerController with camera source with editはい:ビデオトリミングが機能しません

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

allowsEditing:ユーザーが選択された静止画像または動画を編集できるかどうかを示すブール値。あなたは、ユーザーが静止画や動画を編集できるようにする場合は、デリゲートが行われた編集に関する情報で辞書を受けることができる

@property(アトミック)BOOL allowsEditing

議論。デリゲートのプロトコルはUIImagePickerControllerDelegate Protocol Reference.

で説明されています。これは参考になると思います。

0

あなたはインフォ[UIImagePickerControllerEditedImage]から取得する必要があり - (無効)imagePickerController:私は信じている(NSDictionaryの*)情報

:(UIImagePickerController *)ピッカーdidFinishPickingMediaWithInfoを。

関連する問題