0

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

AJ.
  • 1,443
  • 7
  • 19
  • 31

2 Answers2

2

set the mediaTypes property on the UIImagePickerController.

David Maymudes
  • 5,664
  • 31
  • 34
  • yep - that worked setting the media type to kUTTypeMedia. But still the question is not 100% answered. How can I make it possible to record automatically the moment recorder opens up. Do not want user to tap the recording button. – AJ. Aug 07 '09 at 16:32
  • ah. no way to do this, I'm quite sure. – David Maymudes Aug 07 '09 at 19:37
  • David - Thanks for following up! Just a super crazy thought - Is it possible UITouch event at a particular (x, y) programmatically? – AJ. Aug 08 '09 at 06:46
  • so basically you want to simulate a mouse click on the record button? I don't know, but I don't think I've see any app do it, so probably it's either not possible or not allowed. – David Maymudes Aug 11 '09 at 04:28
0

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]
}
Bishal Ghimire
  • 2,580
  • 22
  • 37