mardi 30 juin 2015

Can not play video fullscreen when rotate to landscape mode on Ios 8.1-8.2 using MPMoviePlayerController

In my application, I am trying to play a video in both landscape and portrait mode using MPMoviePlayerController. My present code is working completely fine in ios 7,ios 8.3 but in ios 8.1 and 8.2 the issue is that on changing the rotation of iphone/ipad to landscape, the video still runs in portrait mode in respect to that position and can not fullscreen. I've used a lot of solutions that I found on stackoverflow but can't fix this bug! This is my code

-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
if(IS_IPHONE) {
    BOOL rotation = [[NSUserDefaults standardUserDefaults] boolForKey:IS_KEY_FULLSCREENMOVIE];
if (rotation) {
    return   UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;
    }
    return UIInterfaceOrientationMaskPortrait;
}
return UIInterfaceOrientationMaskAll;

}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {


if(is_Portrait)
    [self performSelector:@selector(exitFullScreen) withObject:nil afterDelay:0];
else if (is_Landscape)
    if(IS_IPHONE)
        [self.moviePlayerController setFullscreen:YES animated:YES];
if (IS_IPAD)
    return YES;
return NO;

}

and

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
if(self.sideMenu.isOpen) {
    [self.sideMenu close];
}
if(toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
   toInterfaceOrientation == UIInterfaceOrientationLandscapeRight){
    [self loadGuiWhenLandScape];
}
else if( toInterfaceOrientation == UIInterfaceOrientationPortrait){
    [self loadGuiWhenPortrait];
}
[self setLayoutCell];
[_gridView reloadData];}

Aucun commentaire:

Enregistrer un commentaire