I'm working on an iPad app that plays a video with MPMoviePlayerController and - based on user interaction - uses thumbnailImageAtTime to try to grab an image from the video.
I've tried using both options MPMovieTimeOptionNearestKeyFrame and MPMovieTimeOptionExact. Regardless of which option, I find that I sometimes get back an empty UIImage. That is to say the UIImage returned appears to be a valid object (!nil) but when I attempt to display this image (in a UImageView) I see nothing.
At other times, it works fine and returns a good thumbnail.
In trying to narrow down the circumstances, the best I can say is that the problem is more likely to appear the first time I call it (ie. early in the movie). Once it has failed, it is more likely to work on successive calls.
In each case, after I call thumbnailImageAtTime I stop the movie player and release it. Later, I re-create the movie player object and load the same movie and use setInitialPlaybackTime to get the movie playing at the same time it was it when the thumbnail was created.
After that, if I call setInitialPlaybackTime again, it almost always works - but not always!
Has anyone else seen this behavior or have a clue as to why this is happening?
My next step is to create a sample app which plays a video and has a button "Get Thumbnail" which will call setInitialPlaybackTime and show the thumbnail on the screen WITHOUT stopping the player each time, as an experiment. Alternately, some input from you might help me avoid all that drudgery!
Thanks!