How can I take screenshot when playing the video in MPMoviePlayer? I am using the below code for take screenshot but the player screen is black color.
1)
- (UIImage*)captureScreenshot:(UIView *)view {
CGRect screenRect = [[UIScreen mainScreen] bounds];
UIGraphicsBeginImageContext(screenRect.size);
CGContextRef ctx = UIGraphicsGetCurrentContext();
[self.view.layer renderInContext:ctx];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(viewImage, self, nil, nil);
return viewImage;
}
2) CGImageRef originalImage = UIGetScreenImage();
This is apple banned.
Please give any other way to get screenshot from the movie player. Please help me.
Somewhat hacktastic, but you could take a screenshot, grab a thumbnail from the movie player (e.g. as suggested here) and overlay the second on the first.