My basic requirement is to capture video using UIImagePickerController. The recording of video should automatically stop after recording 10 seconds of video.
I am getting pretty weird error on iPad 2 (iOS ver 4.3) – “This movie format is not supported” when the video reaches its maximum duration on iPad2.
Here is my piece of code. The code works absolutely fine on iPhone, but gives – “This movie format is not supported” when the video reaches its maximum duration on iPad2.
Any help will be greatly appreciated.
(void) launchCamera : (BOOL) bAlbum
{
UIImagePickerController * pImgPicker = [[UIImagePickerController alloc] init];
pImgPicker.delegate = self;
pImgPicker.mediaTypes =[UIImagePickerController availableMediaTypesForSourceType:pImgPicker.sourceType];
if(m_bRecordVideo)
{
pImgPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
[pImgPicker setVideoQuality: UIImagePickerControllerQualityTypeMedium];
[pImgPicker setCameraCaptureMode: UIImagePickerControllerCameraCaptureModeVideo];
[pImgPicker setVideoMaximumDuration:10];
}
else
{
pImgPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
[pImgPicker setCameraCaptureMode: UIImagePickerControllerCameraCaptureModePhoto];
}
[self presentModalViewController:pImgPicker animated:YES];
[pImgPicker release];
}
I found the solution to above problem.
The following line fixed the issue.
pImgPicker.mediaTypes = [[[NSArray alloc] initWithObjects:(NSString*) kUTTypeMovie, nil] autorelease];
Here is the updated code.
Thanks,
–Prem