title: iOS - How to get thumbnail from video without play?
body: <p>I'm trying to get thumbnail from video and show it in my tableview. Here is my code: </p>
  
  <pre><code>- (UIImage *)imageFromVideoURL:(NSURL *)contentURL {
      AVAsset *asset = [AVAsset assetWithURL:contentURL];
  
      //  Get thumbnail at the very start of the video
      CMTime thumbnailTime = [asset duration];
      thumbnailTime.value = 25;
  
      //  Get image from the video at the given time
      AVAssetImageGenerator *imageGenerator = [[AVAssetImageGenerator alloc] initWithAsset:asset];
  
      CGImageRef imageRef = [imageGenerator copyCGImageAtTime:thumbnailTime actualTime:NULL error:NULL];
      UIImage *thumbnail = [UIImage imageWithCGImage:imageRef];
      CGImageRelease(imageRef);
  
      return thumbnail;
  }
  </code></pre>
  
  <p>But image allways return black. What's wrong?</p>