Search code examples
iosobjective-cmpmovieplayercontrollermpmovieplayer

MpMovieController maximize and minimize button


If you use

   controller.controlStyle = MPMovieControlStyleEmbedded;

there is a button in controlBar to enterFullScreen with a callback with MPMoviePlayerWillEnterFullscreenNotification and when Done button is pressed you get a callback of MPMoviePlayerWillExitFullscreenNotification .How can I have one button in the controlbar that makes the moviePlayer enterFullscreen and when the user taps its again the movieplayer exitsFromFullScreen.


Solution

  • I will post my answer, I subclassed MPMoviePlayerViewController added a button to it for minimizing it, then I added movieplayer as containerViewController(so that I can animate it to small screen). Animation was added to always keep the MPMoviePlayerViewController at the bottom left. Then I added tap gesture to minmized screen view so that when a user taps the minimized screen it should turn back to maximized mode.