2013-10-23 23 views
0

我在一個項目中使用HTTP流式視頻並在MPMoviePlayerController中顯示它。我必須拍攝那個流式視頻的快照。在iOS中的MPMovieController中拍攝SnapShot

我用下面的代碼來做到這一點,但我只得到零值。

UIImage *thumbnail = [mpPlayer thumbnailImageAtTime:yourMoviePlayerObject.currentPlaybackTime 
         timeOption:MPMovieTimeOptionNearestKeyFrame]; 

我必須這麼做非常迫切。請幫助我拍攝流媒體視頻的快照。

在此先感謝。

回答

0

您可以使用UIGraphics採取截圖..

CGSize imageSize = set_image_size_here; 
UIGraphicsBeginImageContext(imageSize); 
CGContextRef imageContext = UIGraphicsGetCurrentContext(); 
[mpPlayer.view.layer renderInContext:imageContext]; 

//檢索屏幕顯示圖像

UIImage *imagefinal = UIGraphicsGetImageFromCurrentImageContext(); 
UIGraphicsEndImageContext();