Display image of first frame of movie in MPMoviePlayerController before playing movie

I am starting to develop an iPhone. I have an MPMoviePlayerController object that loads a video from my application resource. I set backgroundColor MPMoviePlayer to clear the color. I set the shouldAutoplay property to NO. Before the user presses the play button, a blank screen is displayed. I tried to get the first image using the following method

UIImage *thumbnail = [self.videoPlayer thumbnailImageAtTime:0 timeOption:MPMovieTimeOptionNearestKeyFrame]; 

But where should I set this image so that the black screen that appears before the user presses the play button will contain only a thumbnail. Please, help.

+4
source share
1 answer

You set the transparent color as the background color. So try setting the image below ur movieplayer, and if it continues to show a black screen, add it above ur player. When the user plays the video, just hide ur imageview.

+4
source

Source: https://habr.com/ru/post/1396218/


All Articles