2012-05-07 52 views
2

我想從我的代碼中刪除movie.Stop()行。如何從電影中獲取縮略圖,而無需播放啓動Monotouch

還有什麼其他方法可以用來從電影中獲得縮略圖?

NSUrl data = new NSUrl(info.ObjectForKey(new NSString("UIImagePickerControllerMediaURL")).ToString()); 

//get the video thumbnail 
MPMoviePlayerController movie = new MPMoviePlayerController(data); 
movie.Stop(); 
UIImage videoThumbnail = movie.ThumbnailImageAt(0.0, MPMovieTimeOption.NearestKeyFrame); 
movie.Stop(); 
+0

感謝您的編輯 –

回答

0

我運行如下代碼,它似乎在我寫的應用程序中工作得很好。請注意ShouldAutoplay = false;

NSUrl data = new NSUrl(info.ObjectForKey(new NSString("UIImagePickerControllerMediaURL")).ToString()); 

//get the video thumbnail 
MPMoviePlayerController movie = new MPMoviePlayerController(data); 
movie.ShouldAutoplay = false; 
UIImage videoThumbnail = movie.ThumbnailImageAt(0.0, MPMovieTimeOption.NearestKeyFrame); 
+0

似乎工作,謝謝。 –

相關問題