title: How to take a screenshot from an video playing through MPMediaPlayerController in iPhone?
body: <p>Can anybody help me in this? I want to get an screenshot from an video playing through MPMediaPlayerController. What i have tried so far is:-</p>
  
  <pre><code>-(void)viewDidLoad
  {
  NSURL *tempFilePathURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"LMFao" ofType:@"mp4"]];
  player = [[MPMoviePlayerController alloc] initWithContentURL:tempFilePathURL];
  [player setControlStyle:MPMovieControlStyleFullscreen];
  //Place it in subview, else it won’t work
  player.view.frame = CGRectMake(0, 0, 320, 400);
  [self.view addSubview:player.view];
  }
  
  -(IBAction)screenshot
  {
  CGRect rect = [player.view bounds];
  UIGraphicsBeginImageContext(rect.size);
  CGContextRef context = UIGraphicsGetCurrentContext();
  [player.view.layer renderInContext:context];   
  image = UIGraphicsGetImageFromCurrentImageContext();
  UIGraphicsEndImageContext();
  
  imgView = [[UIImageView alloc] initWithFrame:CGRectMake(150, 150, 100, 100)];
  [imgView setImage:image];
  imgView.layer.borderWidth = 2.0;
  [self.view addSubview:imgView];
  }
  </code></pre>
  
  <p>And what i ve got now is this:-</p>
  
  <p><img src="https://i.stack.imgur.com/GJgdi.png" alt="ScreenShot"></p>
  
  <p>what is happening now is my player's button are getting captured in ScreenShot but my video's image is not been getting.I'm using this context method to capture my image because
  i have an overlay on my video,using thumbnail method i cant capture video with overlay but i want to get video's image with overlay.</p>
  
  <p><strong>EDIT:</strong>
  what i want is getting screenshot of both this video and drawing overlay as shown in this image
  <img src="https://i.stack.imgur.com/I0eKS.png" alt="Overlay on Video"></p>
  
  <p>But what i m getting is by one method i got only video not overlay in my screenshot that method is thumbnail method,i was doing thumbnailing in that which is given by MPMoviePlayerController and by second method i m getting only overlay not an video in ma screenshot,that method is context method.i'm getting context of rect.Now i thought solution for this may be is k i combine both these images.So help me out by giving suggestion is merging images will work for me or not???</p>
  
  <p>Please help.Thanks :)</p>