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");
}
}
}