Hi everyone, how I can access the video galley in my iPhone view SDK. What the object I must to use to this that task.
I want to show all videos ( on iPhone/iPod ) in my app and then upload selected videos on web server.
Thanks.
Hi everyone, how I can access the video galley in my iPhone view SDK. What the object I must to use to this that task.
I want to show all videos ( on iPhone/iPod ) in my app and then upload selected videos on web server.
Thanks.
The starting point is UIImagePickerController
to choose a video, and MPMoviePlayerController
and MPMoviePlayerViewController
for playback.
First, create a UIImagePickerController
On your class, you will need to implement the UIImagePickerControllerDelegate protocol and wire it up to the delegate
property on the picker. You should be able to get the location of the media selected from didFinishPickingMediaWithInfo
once the user has selected something.
// untested
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
// this is the file system url of the media
NSURL* videoUrl = [info objectForKey:UIImagePickerControllerMediaURL];
// TODO: read in data at videoUrl and write upload it to your server
}
If you use UIImagePickerController, be sure to play around with the sourceType property to access the library instead of the live camera. See UIImagePickerControllerSourceType for details.
These are your options:
enum { UIImagePickerControllerSourceTypePhotoLibrary, UIImagePickerControllerSourceTypeCamera, UIImagePickerControllerSourceTypeSavedPhotosAlbum };