MPMoviePlayerController displays a ghost image of the last frame when calling stop play

Whenever I stop a video, call. [video.moviePlayer setInitialPlaybackTime:0]; [video.moviePlayer prepareToPlay];I get the ghost of the last frame before playing the video. Any idea how to prevent this?

- (void)prepareVideo {  
    video = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:kVideoURL]];
    [video.moviePlayer setControlStyle:MPMovieControlStyleFullscreen];
    [video.moviePlayer setScalingMode:MPMovieScalingModeAspectFit];
    [video.moviePlayer stop];
    [videoFrame addSubview:video.view];
    [video.view setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];

    [[NSNotificationCenter defaultCenter] addObserver:self 
                                             selector:@selector(playbackFinished:) 
                                                 name:MPMoviePlayerPlaybackDidFinishNotification 
                                               object:video.moviePlayer];
}

- (void)playVideo {
    [video.moviePlayer stop];
    [video.moviePlayer setInitialPlaybackTime:0];
    [video.moviePlayer prepareToPlay];
    [video.moviePlayer play];

    [self showVideo];
}



- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    UITouch *touch = [touches anyObject];

    if (touch.view.tag == 101) {
        [self playVideo];
    }
}
+3
source share

All Articles