开发者

Select video from video library in iphone

开发者 https://www.devze.com 2023-03-23 01:13 出处:网络
I am new to objective c and ios development I want 开发者_如何学Pythonto select a video from video library of iphone.

I am new to objective c and ios development I want 开发者_如何学Pythonto select a video from video library of iphone. i can chhose images using UIImageview Is there any possibility to do this


u have to use UIImagePickerController

below tutorial for pick up image

http://iphone.zcentric.com/2008/08/28/using-a-uiimagepickercontroller/

where u have to specify mediaTypes of UIImagePickerControllerObject to get video

Check the docs and choose what type you need.

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


You can't choose images using UIImageView, that is for displaying images. You can easily use UIImagePickerController to choose images; to use it to choose videos instead, just assign an array containing kUTTypeMovie to the picker's mediaTypes property:

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

It's also possible (in iOS 4.0 and above) to access the library at a lower level, using ALAssetsLibrary.

If you're asking how you can display thumbnails of videos in your own interface (and you're targeting iOS 4.0 or above), look into AVAssetImageGenerator to generate the thumbnails and then display them as you would any image. If you're asking how to play a movie, look into MPMoviePlayerController.


This topic may be too old. But I think there's a link that may help others who seek for a similar solution (for example, me). It use storyboard as well as new framework features introduced in iOS5 and above (ALAssetsLibrary, AVFoundation ...). Here it is How to Play, Record, and Edit Videos in iOS

Hope this help.

0

精彩评论

暂无评论...
验证码 换一张
取 消