I am using an overlay button to start video recording on iPad.
When I call [imagePickerController startVideoCapture], I get "takingvideo activity indicator already cleared"
The iPad doesn't start recording. The recording starts after calling the startVideoCapture again. Below is my code. Any help would be appreciated.
- (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.video开发者_如何学CQuality = UIImagePickerControllerQualityTypeMedium;
self.imagePickerController.videoMaximumDuration = 180;
self.imagePickerController.cameraCaptureMode = UIImagePickerControllerCameraCaptureModeVideo;
self.imagePickerController.cameraDevice = UIImagePickerControllerCameraDeviceFront;
isCapturingVideo = TRUE;
BOOL result = [self.imagePickerController startVideoCapture];
NSLog(@"Result Camera: %@", result?@"YES":@"NO");
}
}
}
I believe it has to do with isCapturingVideo
flag in your code. Documentation says Calling this method while a movie is being captured has no effect.
.
I suspect that flag is not getting updated properly. you can try force closing( using stopVideoCapture) the video before starting and see if it works.
精彩评论