Skip to content

Commit

Permalink
Merge pull request souvik-ghosh#94 from pitch45/frame-accurate-ios
Browse files Browse the repository at this point in the history
Request frame-accurate image generation on iOS
  • Loading branch information
souvik-ghosh authored Aug 24, 2023
2 parents 0c36691 + 482a1f7 commit 529ae3d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ios/CreateThumbnail.m
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ - (void) cleanDir:(NSString *)path forSpace:(unsigned long long)size {
- (void) generateThumbImage:(AVURLAsset *)asset atTime:(int)timeStamp completion:(void (^)(UIImage* thumbnail))completion failure:(void (^)(NSError* error))failure {
AVAssetImageGenerator *generator = [[AVAssetImageGenerator alloc] initWithAsset:asset];
generator.appliesPreferredTrackTransform = YES;
generator.maximumSize = CGSizeMake(512, 512);
generator.maximumSize = CGSizeMake(512, 512);
generator.requestedTimeToleranceBefore = CMTimeMake(0, 1000);
generator.requestedTimeToleranceAfter = CMTimeMake(0, 1000);
CMTime time = CMTimeMake(timeStamp, 1000);
AVAssetImageGeneratorCompletionHandler handler = ^(CMTime timeRequested, CGImageRef image, CMTime timeActual, AVAssetImageGeneratorResult result, NSError *error) {
if (result == AVAssetImageGeneratorSucceeded) {
Expand Down

0 comments on commit 529ae3d

Please sign in to comment.