0

I was using UIImagePickerController to select the video files from Image Gallery of IPhone using

imagePicker.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeMovie];

and that code is working fine and picker shows me all available videos in Gallery but the problem is that UIImagePickerController do not shows all videos of IPhone like videos on Video folder of Iphone and also the synched videos on IPhone. In short it only shows video recorded from Iphone only. But my requirement is to show all videos in Iphone and getting their path so that I can write them using FileManager.

I also tried using

MPMediaPickerController *picker =
    [[MPMediaPickerController alloc] initWithMediaTypes: MPMediaTypeAnyAudio];

    picker.delegate                     = self;
    picker.allowsPickingMultipleItems   = YES;
    picker.prompt                       = NSLocalizedString (@"AddSongsPrompt", @"Prompt to user to choose some songs to play");

    [[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleDefault animated:YES];

    [self presentModalViewController: picker animated: YES];
    [picker release];

But it also shows me music files of Iphone not video. Please some one has any idea how to do this?

Virja Rahul
  • 415
  • 2
  • 4
  • 12
Abhinav
  • 191
  • 8

1 Answers1

0

try initWithMediaTypes:MPMediaTypeAnyVideo instead of initWithMediaTypes: MPMediaTypeAnyAudio

also see this link for more information, MPMediaItem_ClassReference

Paras Joshi
  • 20,427
  • 11
  • 57
  • 70
  • Thanks Paras. Actually I made a mistake in posting the code sample. I used initWithMediaTypes:MPMediaTypeAnyVideo instead of initWithMediaTypes: MPMediaTypeAnyAudio but still not working for me.I also looked at class reference but its not working for me. – Abhinav Nov 09 '12 at 08:37
  • hey @Abhinav see this link may you can find something from this.. http://www.cocos2d-iphone.org/forum/topic/1980.. here for Music .. just see where you wrong from this code.. :) – Paras Joshi Nov 09 '12 at 08:41
  • I am using same code just by changing initWithMediaTypes: MPMediaTypeAnyVideo. :( – Abhinav Nov 09 '12 at 08:48
  • see this code with AssetLibrary http://stackoverflow.com/questions/11390614/display-all-videos-stored-in-document-directory – Paras Joshi Nov 09 '12 at 08:49
  • hey @Abhinav just try to use this library and use it.. http://developer.apple.com/library/ios/#documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/01_UsingAssets.html – Paras Joshi Nov 09 '12 at 08:51
  • I just found you post and want to ask you if you found a good solution. I am having a somewhat related issue here: https://stackoverflow.com/questions/57987133/trying-to-make-a-file-copy-from-mpmediapickercontroller-but. I know it's a long time ago :) – Michel Sep 19 '19 at 03:04