iPhone video recording: "cameraCaptureMode 1 not available because mediaTypes does contain public.movie"

Danail picture Danail · Sep 11, 2010 · Viewed 16.7k times · Source

I tried to record a video. The message I got is from the following code on the device:

UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePickerController.allowsEditing = YES;
imagePickerController.cameraCaptureMode = UIImagePickerControllerCameraCaptureModeVideo;
imagePickerController.delegate = self;
[self presentModalViewController:imagePickerController animated:YES];
[imagePickerController release];

Any ideas? I think it should be really easy to take a video. When I start the "Camera" app of the phone I have the choice between video and picture. Shouldn't it be available for my app also?

Answer

Danail picture Danail · Sep 11, 2010

The problem was the way I was trying to set the mode to video mode.

Instead of using this:

imagePickerController.cameraCaptureMode = UIImagePickerControllerCameraCaptureModeVideo;

I changed it to this:

imagePickerController.mediaTypes =  
        [NSArray arrayWithObject:(NSString *)kUTTypeMovie];

and it worked.