Reputation: 3018
I want to pick a video from iPhone for my application for uploading on the Web. I am using the UIImagePickerController for it.
For for opening picker
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.mediaTypes = [[NSArray alloc] initWithObjects:(NSString *)kUTTypeMovie, nil];
[self presentModalViewController:imagePicker animated:YES];
It opens the photo library and only shows the movie type content.
Now I have the following questions:
If I am able to choose then how do I get video detail as delegate method is
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)editInfo {
and it has (UIImage *)img parameter. How do I get it as video?
Upvotes: 2
Views: 5103
Reputation: 94844
You're using the wrong delegate method. iOS 3.0 introduced imagePickerController:didFinishPickingMediaWithInfo:
to replace imagePickerController:didFinishPickingImage:editingInfo:
. This new method receives an NSDictionary which contains a number of key-value pairs related to the chosen image/video; in your case, you'll want to check the value for UIImagePickerControllerMediaURL
.
Upvotes: 2