How do I pick and record video using UIImagePickerController for iPhone?
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:- How do I get the video when I select the video then it ready to play and then when I click on choose then its compression nothing happen .. even I am not able to cancel it.
- As we have separate folders in iphone then how do we open video folder?
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?
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
.
精彩评论