views:

45

answers:

1

Hi,

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

A: 

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.

Steven
Accept your own answer, cause it is correct - to exclude question from unanswered list (at least).
kpower