AVPlayer 对MP4等视频格式进行截屏截屏

CMTime currentTime =playerItem.currentTime;
AVAssetImageGenerator *generator = [AVAssetImageGeneratorassetImageGeneratorWithAsset:urlAsset];
AVAssetImageGeneratorCompletionHandler handler = ^(CMTime requestedTime,CGImageRef im, CMTime actualTime,AVAssetImageGeneratorResult result,NSError *error){

if (result ==AVAssetImageGeneratorSucceeded) {
UIImage * thumbImg = [UIImageimageWithCGImage:im];
[selfsaveImage:thumbImg];
dispatch_async(dispatch_get_main_queue(), ^{
_imageView.image = thumbImg;
});
}
【AVPlayer 对MP4等视频格式进行截屏截屏】};
[generator generateCGImagesAsynchronouslyForTimes:[NSArrayarrayWithObject:[NSValuevalueWithCMTime:currentTime]]completionHandler:handler];

    推荐阅读