3

I am now trying to implement a app like picking image and video from device photo album and uploading it to server..

here i can able to display both image and video in a table view using uiimagepickercontoller but i can only able to pick image not video..

How to pick a video form photo lib using UIimagepickercontroller....

UIImagePickerController *ipc = [[UIImagePickerController alloc] init];
ipc.sourceType =  UIImagePickerControllerSourceTypePhotoLibrary;
ipc.mediaTypes =[UIImagePickerController availableMediaTypesForSourceType:ipc.sourceType];     
ipc.delegate = self;
ipc.editing = NO;
[self presentModalViewController:ipc animated:YES]; 

`

Rinju Jain
  • 1,694
  • 1
  • 14
  • 23
The Debugger
  • 330
  • 8
  • 19
  • Hi i am also creating a video application where initially i want to browse video from photolibrary and i have read the documents and the used the code provided in the docs but it is not working .It does not allow me to browse for video.Could you please help or provide me some code.thanks – Rocky May 10 '11 at 06:19

2 Answers2

8

Check the docs and choose what type you need.

myImagePickerController.mediaTypes =
    [[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil];
Max
  • 16,679
  • 4
  • 44
  • 57
  • 1
    thanks max but my question id in didFinishPickingImage the return type is image how to change it as video – The Debugger Mar 13 '11 at 10:48
  • have you used UIImagePickerControllerMediaURL ? – Max Mar 13 '11 at 10:51
  • no am not used can u tell me abt that or any like to source code regarding – The Debugger Mar 13 '11 at 10:53
  • check docs for http://developer.apple.com/library/ios/documentation/uikit/reference/UIImagePickerControllerDelegate_Protocol/UIImagePickerControllerDelegate/UIImagePickerControllerDelegate.html#//apple_ref/occ/intfm/UIImagePickerControllerDelegate/imagePickerController:didFinishPickingMediaWithInfo: it returns dictionary via imagePickerController:didFinishPickingMediaWithInfo: and UIImagePickerControllerMediaURL is key – Max Mar 13 '11 at 10:55
  • hey max in dictionary return type is null when i picking the image.. wats d prob.. – The Debugger Mar 13 '11 at 11:12
0

It is Verified and Tested on Both iPhone and iPad For picking video.

@property (strong,nonatomic) UIPopoverController *popOver;

property is Set For iPad access.

UIImagePickerController *videoPicker=[[UIImagePickerController alloc] init];
videoPicker.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;
videoPicker.mediaTypes=[[NSArray alloc] initWithObjects:(NSString *)kUTTypeMovie, nil];
videoPicker.delegate=self;

if( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
    UIPopoverController *popController=[[UIPopoverController alloc] initWithContentViewController:videoPicker];
    [popController presentPopoverFromRect:CGRectMake(0, 600, 160, 300) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
    self.popOver=popController;
}
else
{
    [self presentViewController:videoPicker animated:YES completion:nil];
}
Vaibhav Sharma
  • 1,123
  • 10
  • 22