views:

95

answers:

1

Hi All, I want to play a video in iphone in potrait mode .I have written the following code



-(void)buttonEvent
{ 
 NSBundle *bundle = [NSBundle mainBundle];
 NSString *moviePath = [bundle pathForResource:@"Movie" ofType:@"m4v"];
 NSURL *URL = [NSURL fileURLWithPath:moviePath];
 self.moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:URL];
 moviePlayer.view.frame = self.view.frame;
 //moviePlayer.fullscreen = YES;
 [self.moviePlayer setControlStyle:MPMovieControlStyleFullscreen];
 [self.view addSubview:self.moviePlayer.view];
 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
 moviePlayer.scalingMode = MPMovieScalingModeFill;
 [self.moviePlayer play];
}

-(void)movieFinishedCallback:(NSNotification*)aNotification 
{ [[NSNotificationCenter defaultCenter] removeObserver:self];
moviePlayer.fullscreen=NO;
 [self.moviePlayer stop];
 [self.moviePlayer.view removeFromSuperview];
 self.moviePlayer = nil;
 //animationTimer = nil;
 NSLog(@"animationTimer %@",animationTimer);
}

The movie plays in full mode but after some time the status bar gets hidden and white portion is dispayed there .Also when the movie player is removed from superview status bar is not seen.i have tried changing the frames but nothing is working out .i also tried to set the fullscreen property as yes but problem is not solved.how to solve this problem

A: 

you can bring back the status bar which was hidden by calling in
-(void) moviePlayBackDidFinish:(NSNotification*)notification
{

[[UIApplication sharedApplication] setStatusBarHidden:NO];

}

check out this nice article http://cocoabugs.blogspot.com/2010/08/troubleshoting-iphone.html

jeeva