Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIImagePickerController - Setting a maximum video duration [closed]

Tags:

I am using the following code to allow users to record video using their iPhone camera, and then upload it directly to my server. I would like to put a limit on the length of the video they can record (5 seconds in this example) and it looks like using videoMaximumDuration would be the obvious way of doing that, but it has no effect.

Does anyone have any ideas?

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:imagePicker animated:YES];
imagePicker.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:imagePicker.sourceType]; 
imagePicker.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeMovie];
[imagePicker setVideoMaximumDuration:5];
[imagePicker release];

I've tried it with allowsEditing as YES and NO, but it made no difference.

Thanks,

Steven

like image 972
Steven Elliott Avatar asked Oct 05 '10 01:10

Steven Elliott


1 Answers

I'm sorry, but I just solved it ... I'm such a dunce. Moving the presentModalViewController to the end did the trick. I can't believe I didn't notice that!

Thanks guys.

like image 172
Steven Elliott Avatar answered Oct 12 '22 02:10

Steven Elliott