2011-07-04 24 views
3

我正在使用疊加按鈕在iPad上開始視頻錄製。UIImagePicker StartVideo問題

當我打電話[imagePickerController startVideoCapture],我得到「takingvideo活動的指標已經清除」

的iPad不開始錄製。在再次調用startVideoCapture之後開始錄製。 以下是我的代碼。任何幫助,將不勝感激。

- (IBAction)startStop:(id)sender 
{ 
    if (isCapturingVideo) 
    { 
     isCapturingVideo = FALSE; 
     [self.imagePickerController stopVideoCapture]; 
    } 

    else if (!isCapturingVideo) 
    { 

     NSArray *mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeCamera]; 
     NSArray *videoMediaTypesOnly = [mediaTypes filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"(SELF contains %@)", @"movie"]]; 

     if ([videoMediaTypesOnly count] == 0)  //Is movie output possible? 
     { 
      UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Sorry but your device does not support video recording" 
                    delegate:nil 
                  cancelButtonTitle:@"OK" 
                 destructiveButtonTitle:nil 
                  otherButtonTitles:nil]; 
      [actionSheet showInView:[[self view] window]]; 
      [actionSheet autorelease]; 
     } 
     else 
     { 

      self.imagePickerController.mediaTypes = videoMediaTypesOnly; 
      self.imagePickerController.videoQuality = UIImagePickerControllerQualityTypeMedium; 
      self.imagePickerController.videoMaximumDuration = 180; 
      self.imagePickerController.cameraCaptureMode = UIImagePickerControllerCameraCaptureModeVideo; 
      self.imagePickerController.cameraDevice = UIImagePickerControllerCameraDeviceFront; 
      isCapturingVideo = TRUE; 
      BOOL result = [self.imagePickerController startVideoCapture]; 
      NSLog(@"Result Camera: %@", [email protected]"YES":@"NO"); 

     } 


    } 
} 

回答

0

我相信它與你的代碼中的isCapturingVideo標誌有關。文檔說Calling this method while a movie is being captured has no effect.
我懷疑標誌沒有正確更新。您可以嘗試在開始之前強制關閉(使用stopVideoCapture)視頻,並查看它是否有效。