Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import <AVFoundation/AVFoundation.h>
- AVAssetImageGenerator *imageGenerator = [[AVAssetImageGenerator alloc] initWithAsset:self];
- CMTime duration = self.duration;
- CGFloat durationInSeconds = duration.value / duration.timescale;
- CMTime time = CMTimeMakeWithSeconds(durationInSeconds * 0.5, (int)duration.value);
- CGImageRef imageRef = [imageGenerator copyCGImageAtTime:time actualTime:NULL error:NULL];
- UIImage *screenshot = [UIImage imageWithCGImage:imageRef];
- CGImageRelease(imageRef);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement