MPMoviePlayerController fullscreen quirk in iPad

后端 未结 7 1773
無奈伤痛
無奈伤痛 2020-12-23 23:22

I want to show a MPMoviePlayerController in a view controller and let the user toggle full screen with the default controls, like the YouTube app. I\'m using the following c

7条回答
  •  遥遥无期
    2020-12-24 00:01

    Yeah, I'm experiencing this problem as well. It definitely appears to be a bug in the MPMoviePlayerController itself.

    The workaround I've settled on in my application is to just correct the status bar myself when I exit fullscreen mode:

    - (void)playerDidExitFullscreen:(NSNotification *)notification {
        MPMoviePlayerController *moviePlayer = (MPMoviePlayerController *) notification.object;
    
        if (moviePlayer == self.player) {
            UIApplication *app = [UIApplication sharedApplication];
            if (app.statusBarOrientation != self.interfaceOrientation) {
                [app setStatusBarOrientation:self.interfaceOrientation animated:NO];
            }
        }
    }
    

    This doesn't fix the problem while in fullscreen mode, but it does fix it afterwards.

    Note of course that the function needs to be added to the notification:

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerDidExitFullscreen:) name:MPMoviePlayerDidExitFullscreenNotification object:nil];
    

提交回复
热议问题