IOS 6 Issue with MPMoviePlayerController

2019-02-23 13:15发布

问题:

Please check the below code:

(void) moviePlayerDidExitFullscreen:(NSNotification*)notification 
{

 MPMoviePlayerController *player = [notification object];

[[NSNotificationCenter defaultCenter] removeObserver:self     

name:MPMoviePlayerDidExitFullscreenNotification
                                                  object:player];

 [player setControlStyle:MPMovieControlStyleNone]; 

    if (isPlaying)
    {
        [self stopCurrentMoviePlayer];
    }
}

The issue is that this works perfectly in IOS 5, but not working in IOS 6 updates iPad3.

The movie player is not closing after the video is complete and I need to click done button every time to close the Movie Player.

Can anyone provide a solution for this issue?

回答1:

Clicking done will call moviePlayerDidExitFullscreen

But if you let the movie finish normally moviePlaybackDidFinish is called but since IOS 6 it doesn't exit you from fullscreen mode. So the fix is to add player.fullscreen = FALSE; right before calling [player.view removeFromSuperview];