App is portrait mode but play video in landscape in iOS
You need to first change in appdelegate:
Property synthesize allowRotation in appdelegate.
Property synthesize allowRotation in appdelegate.
-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { if (self.allowRotation) { return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight; } return UIInterfaceOrientationMaskPortrait; }
Register Notifications for the full screen control in your viewController.m :[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayerWillEnterFullscreenNotification:) name:MPMoviePlayerWillEnterFullscreenNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayerWillExitFullscreenNotification:) name:MPMoviePlayerWillExitFullscreenNotification object:nil];
//Write these two methods in viewController.m
- (void) moviePlayerWillEnterFullscreenNotification:(NSNotification*)notification {self.allowRotation = YES; } - (void) moviePlayerWillExitFullscreenNotification:(NSNotification*)notification { self.allowRotation = NO; }
More detail you can see following link:
See this link
Second link:
No comments:
Post a Comment