title: How to get the frame image before play m3u8 video streaming? iOS
body: <p>I have a demand: get the frame image before play video streaming(<strong>m3u8</strong>) , as a video preview display. I use <strong>AVPlayerItemVideoOutpu</strong> <strong>copyPixelBufferForItemTime: itemTimeForDisplay:</strong> only when play the video streaming to get to the frame image , do you have other method? thanks!!</p>
  
  <p><strong>This is my code :</strong>            </p>
  
  <pre><code>CMTime itemTime = self.playerItem.currentTime;
  CVPixelBufferRef pixelBuffer = [_playerItemVideoOutput copyPixelBufferForItemTime:itemTime itemTimeForDisplay:nil];
  CIImage *ciImage = [CIImage imageWithCVPixelBuffer:pixelBuffer];
  CIContext *temporaryContext = [CIContext contextWithOptions:nil];
  CGImageRef videoImage = [temporaryContext
                                   createCGImage:ciImage
                                   fromRect:CGRectMake(0, 0,
                                                       CVPixelBufferGetWidth(pixelBuffer),
                                                       CVPixelBufferGetHeight(pixelBuffer))];
  
  UIImage *uiImage = [UIImage imageWithCGImage:videoImage];
  CGImageRelease(videoImage);
  NSLog(@"uiImage：%@", uiImage);
  </code></pre>