找到了答案,但我不得不等待,直到iOS4的(該功能在3.2出來)
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
if ([mediaType compare:(NSString*)kUTTypeMovie] == NSOrderedSame) {
// deal with the movie
[[picker parentViewController] dismissModalViewControllerAnimated:YES];
NSURL *mediaUrl = [info objectForKey:UIImagePickerControllerMediaURL];
NSLog(@"media Url = %@, path %@", mediaUrl, [mediaUrl path]);
MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:mediaUrl];
UIImage *thumbnail = [[moviePlayer thumbnailImageAtTime:0.0 timeOption:MPMovieTimeOptionNearestKeyFrame] retain];
[moviePlayer release];
NSLog(@"thumbnail = %@", thumbnail);
[thumbnail release];
}
}
的iOS 5.1.1下仍然有效! – tobinjim 2012-05-11 16:35:35
thumbnailImageAtTime不推薦使用iOS 7,我該怎麼辦? (通過不推薦的蘋果政策蘋果支持不推薦使用的代碼長達3年,但這意味着在未來3年我必須更改我的代碼,如果我想在應用程序商店更新我的應用程序),請幫忙? – evya 2013-11-07 16:55:50