Reputation: 1463
Using UIImagePicker class I can select the UIImagePickerControllerSource as UIImagePickerControllerSourceTypeCamera. This would show up both the options, camera as well as video recoreder.
I want only the video recording option to be available to the user. And as soon as user opens it starts recording without the need to tap record button.
Anyone who knows how is it possible?
Thanks
Upvotes: 0
Views: 1343
Reputation: 2610
in your .h file
#define MAX_VIDEO_DURATION 10
@interface VideoCaptureVC_iPhone : UIViewController
<UIActionSheetDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate>
{
IBOutlet UIImageView *imageView;
UIImagePickerController *picker;
}
in your .m file
- (void)viewDidLoad
{
// Create UIImagePickerController
picker = [[UIImagePickerController alloc] init];
picker.videoQuality = UIImagePickerControllerQualityTypeMedium;
picker.mediaTypes = [NSArray arrayWithObject:(NSString*)kUTTypeMovie];
picker.videoMaximumDuration = MAX_VIDEO_DURATION;
// Set the source type to the camera
[picker setSourceType:UIImagePickerControllerSourceTypeCamera];
// Set ourself as delegate
[picker setDelegate:self];
// Always check to see if there is a front facing camera before forcing one on the picker
if([UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceFront]){
[picker setCameraDevice:UIImagePickerControllerCameraDeviceFront];
}
[picker setShowsCameraControls:NO];
[picker takePicture]
}
Upvotes: 0
Reputation: 5654
set the mediaTypes property on the UIImagePickerController.
Upvotes: 2