Objective-C Tips & Trick - Prioregroup.com
[Objective-C] Capture a screenshot from mov video types
       
back

#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);






Copyright © 1996-2018 Centro Studi Informatica di Danilo Priore. All rights reserved. P.I.10149810581.
prioregroup.com