UIImagePickerController for movie Item

Deepak picture Deepak · Sep 4, 2009 · Viewed 14.9k times · Source

I am writing a simple video uploader application on iPhone 3GS where I first direct the user to photos album, and then select the video to share or upload. I am using the UIImagePickerController in the following way:

videoPickerCtrl = [[UIImagePickerController alloc] init];
 videoPickerCtrl.delegate = self;
 videoPickerCtrl.sourceType =  UIImagePickerControllerSourceTypePhotoLibrary;
 videoPickerCtrl.mediaTypes = [UIImagePickerController  availableMediaTypesForSourceType:videoPickerCtrl.sourceType];   

 videoPickerCtrl.allowsImageEditing = NO;
 videoPickerCtrl.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeMovie];
 [window addSubview:videoPickerCtrl.view];

But I can see that once the controller is invoked, there is a disturbing video trimming interface that is presented. Once I press "choose", the video is always trimmed no matter whether I touch the trimming controls or not. Is there any way to get around this trimming interface and directly get the path of the video file ?

Answer

Ole Begemann picture Ole Begemann · Oct 27, 2009

You should set allowsEditing = NO; instead of allowsImageEditing = NO; (which has been deprecated in 3.1). Then, the trimming interface should not appear unless the selected movie is longer than 10 minutes (from the docs: "Maximum movie duration is 10 minutes. If a user picks a movie that is longer in duration than 10 minutes, they are forced to trim it before saving it.").