6

I want to display the (static) first frame of a video in my app as a preview.

I have read through this thread and understand that I could use a thumbnail :

Getting a thumbnail from a video url or data in iPhone SDK

I have two questions :

1) What is the resolution of the thumbnail ? I am looking to make the preview a 4:3 format and wonder if the image will end up looking blurry if enlarged.

2) Does the resolution of the thumbnail differ for iPhone / iPad ?

3) Is there a better way to grab and display the first frame of a video ?

Thank you.

Community
  • 1
  • 1
GuybrushThreepwood
  • 5,598
  • 9
  • 55
  • 113

1 Answers1

9

Following code may helping to you

NSString *str = [[self.vedioArray objectAtIndex:i] valueForKey:@"vName"];
    NSURL *videoURL = [NSURL URLWithString:str] ;
    MPMoviePlayerController *player = [[[MPMoviePlayerController alloc] initWithContentURL:videoURL]autorelease];
  UIImage  *thumbnail = [player thumbnailImageAtTime:1.0 timeOption:MPMovieTimeOptionNearestKeyFrame];
    player = nil;
Ganpat
  • 768
  • 3
  • 15
  • 30
Nimit Parekh
  • 16,776
  • 8
  • 50
  • 72
  • 1
    Thanks Neon - this may be a stupid question, but is it possible to use that framework in an existing project ? It assumes you are going to create a new project. – GuybrushThreepwood Apr 18 '12 at 15:36
  • `MPMoviePlayerController ` is deprecated, so `AVPlayerViewController ` should be used. – Ganpat Nov 06 '18 at 06:24