Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

newtoiphonesdk

macrumors 6502a
Original poster
Jul 30, 2010
567
2
If I wait for the status bar and time bar to disappear after playing a movie, and rotate to landscape, and back to portrait, then click done, the original view shifts up to slightly behind the status bar (see picture below). Here is my code for playing the video:
Code:
- (IBAction)play {
		NSBundle *bundle = [NSBundle mainBundle];
		NSString *moviePath = [bundle pathForResource:@"welcome" ofType:@"mp4"];
		NSURL  *movieURL = [[NSURL fileURLWithPath:moviePath] retain];
		self.player =
        
        [[MPMoviePlayerController alloc] initWithContentURL: movieURL];
        
        [player prepareToPlay];
       
        player.allowsAirPlay = YES;
        player.scalingMode = MPMovieScalingModeAspectFit;

        self.player.view.frame = self.view.frame;

        [self.view addSubview: player.view];
        [self.player setFullscreen:YES animated:YES];

        // ...
        
        [[NSNotificationCenter defaultCenter] 
         addObserver:self
         selector:@selector(movieFinishedCallback:)
         name:MPMoviePlayerPlaybackDidFinishNotification
         object:player];
        
                [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(exitedFullscreen:) name:MPMoviePlayerDidExitFullscreenNotification object:player];

       
        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(moviePlayerWillExitFullscreen:)
                                                     name:MPMoviePlayerWillExitFullscreenNotification
                                                   object:player];

        
        [player play];
	
	
}
	
- (void) movieFinishedCallback:(NSNotification*) aNotification {    
    NSLog(@"MovieDone");
    
    [player.view removeFromSuperview];   
    [[NSNotificationCenter defaultCenter]
     removeObserver:self
     name:MPMoviePlayerPlaybackDidFinishNotification
     object:player];
   }

- (void) exitedFullscreen:(NSNotification*) aNotification {   
        NSLog(@"MovieDone");
    [player.view removeFromSuperview];   
    [[NSNotificationCenter defaultCenter]
     removeObserver:self
     name:MPMoviePlayerDidExitFullscreenNotification
     object:player];
    }
- (void)moviePlayerWillExitFullscreen:(NSNotification*) aNotification {
    [player stop];
    [self dismissMoviePlayerViewControllerAnimated];
    [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerWillExitFullscreenNotification object:player];
}
photo.PNG
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.