The Debugger
The Debugger

Reputation: 340

iphone imagepickerController picking video from photo library

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]; 

`

Upvotes: 3

Views: 7537

Answers (2)

Vaibhav Sharma
Vaibhav Sharma

Reputation: 1123

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];
}

Upvotes: 0

Max
Max

Reputation: 16709

Check the docs and choose what type you need.

myImagePickerController.mediaTypes =
    [[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil];

Upvotes: 8

Related Questions