- (void)displayThumbnail
{
AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:[self outputURL] options:nil];
AVAssetImageGenerator *gen = [[AVAssetImageGenerator alloc] initWithAsset:asset];
gen.appliesPreferredTrackTransform = YES;
CMTime time = CMTimeMakeWithSeconds(1, 30);
NSError *error = nil;
CMTime actualTime;
CGImageRef imageref = [gen copyCGImageAtTime:time actualTime:&actualTime error:&error];
UIImage *thumbnail = [[UIImage alloc] initWithCGImage:imageref];
CGImageRelease(imageref);
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
MainViewController *controller = [mainStoryboard instantiateViewControllerWithIdentifier:@"MainViewController"];
controller.imageView.image = thumbnail;
}
I'm attempting to display a thumbnail of a recorded video in another view controller, but nothing shows up. Am I missing something?
Solved it !
Credits to David and Dan :)
MainViewController.h
MainViewController.m
THCaptureViewController.m