1

AVFullscreenVideoController is the view controller when playing youtube fullscreen in ios8. And I can allow it to rotate by manipulating app delegate method

-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
     /*
     if view controller is AVFullscreenVideoController or MPInlineVideoFullscreenViewController or MPMoviePlayerViewController"
     return UIInterfaceOrientationMaskAllButUpsideDown;
     */
}

My objective is to keep the current UIInterfaceOrientationMask of my view controllers and allow rotation to the fullscreen video when playing.

How can I do the same effect without adding code in the appdelegate.m? Thanks!

Ted
  • 22,696
  • 11
  • 95
  • 109

1 Answers1

0

i found out that fullscreenvideocontroller depends on what you allowed your device to do. Either in target > general > device orientation or in app delegate

-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window;

I just made sure that if my rootviewcontroller is a navigation controller as a rootviewcontroller, i have to implement this methods to put back control to my other view controllers

-(BOOL)shouldAutorotate
{
    return [[self.viewControllers lastObject] shouldAutorotate];
}

-(NSUInteger)supportedInterfaceOrientations
{
    return [[self.viewControllers lastObject] supportedInterfaceOrientations];
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation];
}

And in the case that the view controller presenting the fullscreenvideocontroller is strictly in portrait, refer to this post

Allow video on landscape with only-portrait app

Community
  • 1
  • 1
Ted
  • 22,696
  • 11
  • 95
  • 109