Created
October 19, 2010 15:38
-
-
Save yanguango/634399 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString *video_url = @"http://www.youtube.com/v/2mTS5gGkK9k?fs=1&hl=en_US"; | |
//NSData *video_data = [NSData dataWithContentsOfURL: picture_url]; | |
MPMoviePlayerController *movieController = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:video_url]]; | |
UIImage *videoThumb = nil; | |
if ([movieController respondsToSelector:@selector(thumbnailImageAtTime:timeOption:)]) | |
{ | |
NSLog(@"===============xxxxxxxxxxx========================="); | |
videoThumb = [movieController thumbnailImageAtTime:(NSTimeInterval)2.0 timeOption: MPMovieTimeOptionNearestKeyFrame]; | |
} | |
[videoThumb compressDownTo:200.0]; | |
CGRect mediaFrame = CGRectMake((300 - videoThumb.size.width) / 2, | |
mediaTopMargin, | |
videoThumb.size.width, | |
videoThumb.size.height); | |
UIImageView *videoView = [[UIImageView alloc] initWithFrame:mediaFrame]; | |
videoView.image = videoThumb; | |
[self.view addSubview:videoView]; | |
[videoView release]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment