objective c - MPMoviePlayerController in iOS 8 navigationBar remain visible after exiting Full Screen -
for playing video using mpmovieplayercontroller
,my app supports portrait mode playing video need support landscape too. every thing working fine till ios 7.x. in ios 8.0, after exiting full screen there remains navigation bar. please refer below image.
in app delegate, under supportedinterfaceorientationsforwindow
, following used.
-(nsuinteger)application:(uiapplication *)application supportedinterfaceorientationsforwindow:(uiwindow *)window { if (self.forcelandscaperight) { return uiinterfaceorientationmaskall; } return uiinterfaceorientationmaskportrait; }
noe in controller class initiating mpmovieplayercontroller:
[self.mpmovieplayercontr setcontenturl:object]; [themoviplayer preparetoplay]; self.mpmovieplayercontr.controlstyle = mpmoviecontrolstyleembedded; self.mpmovieplayercontr.scalingmode = mpmoviescalingmodeaspectfit; [self.mpmovieplayercontr play]; self.mpmovieplayercontr.view.autoresizingmask = uiviewautoresizingflexiblewidth|uiviewautoresizingflexibleheight; self.mpmovieplayercontr.shouldautoplay = yes; [themoviplayer setfullscreen:false animated:yes];
also, have notification entering , exiting full screen.
- (void) movieplayerwillenterfullscreennotification:(nsnotification*)notification { ed_appdelegate.forcelandscaperight = yes; [self.mpmovieplayercontr setfullscreen:yes animated:yes]; [self.mpmovieplayercontr play]; } - (void) movieplayerwillexitfullscreennotification:(nsnotification*)notification { ed_appdelegate.forcelandscaperight = no; [self.mpmovieplayercontr setfullscreen:no animated:yes]; [self.mpmovieplayercontr play]; } - (void)orientationchanged:(nsnotification *)notification { uideviceorientation currentorientation = [[uidevice currentdevice] orientation]; ed_appdelegate.forcelandscaperight = no; if (currentorientation == uideviceorientationlandscapeleft ||currentorientation == uideviceorientationlandscaperight ) { [self.mpmovieplayercontr setfullscreen:yes animated:yes]; [self.mpmovieplayercontr play]; ed_appdelegate.forcelandscaperight = yes; } else { if (self.mpmovieplayercontr.playbackstate == mpmovieplaybackstatepaused) { [self.mpmovieplayercontr play]; } [self.mpmovieplayercontr setfullscreen:no animated:yes]; ed_appdelegate.forcelandscaperight = no; } }
above code working fine in ios 7.x, have issue in ios 8.0.
Comments
Post a Comment