2011-07-04 3 views
3

iPad에서 비디오 녹화를 시작하려면 오버레이 버튼을 사용하고 있습니다. UIImagePicker StartVideo 문제

내가 [imagePickerController startVideoCapture] 전화

, 나는

아이 패드 녹음을 시작하지 않는다 "takingvideo 활동 표시 이미 삭제"얻는다. 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 사용) 할 수 있으며 동영상이 제대로 작동하는지 확인할 수 있습니다.