Reputation: 1213
I'm developing a camera app. In that I need to display the last image from camera roll in the bottom. I'm able to do this using ALAssetsLibrary. And if the last item in camera roll is a video, I need to display the first thumbnail image from that video. But how to detect the last item in camera roll is whether photo or video so that i can be able to display whether last image or first image of the video from camera roll?
Thanks in advance.
Upvotes: 0
Views: 107
Reputation: 6570
the delegate method can let you know what is the file a image or a video
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSString *type = [info objectForKey:UIImagePickerControllerMediaType];
//NSLog(@"type=%@",type);
if ([type isEqualToString:(NSString *)kUTTypeVideo] ||
[type isEqualToString:(NSString *)kUTTypeMovie])
{// movie != video
NSURL *urlvideo = [info objectForKey:UIImagePickerControllerMediaURL];
}
else{
// image
}
}
Upvotes: 1