2

I already hide the status bar in my application using [[UIApplication sharedApplication] setStatusBarHidden:YES];. But when I play movie then automatically it display the status bar on the top.

Does anyone knows that how to hide the status bar while playing movie.

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
mobapps
  • 21
  • 1
  • 3

2 Answers2

0
MPMoviePlayerViewController *playercontroller = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:path]];
    [AppShare.viewController presentMoviePlayerViewControllerAnimated:playercontroller];
    //[self.view addSubview: playercontroller.view];
    [self.view addSubview:playercontroller.view];
    playercontroller.moviePlayer.view.frame = CGRectMake(0.0, 0.0, 320.0, 480.0);
    playercontroller.moviePlayer.scalingMode = MPMovieScalingModeAspectFill;
    playercontroller.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
    playercontroller.moviePlayer.controlStyle = MPMovieControlStyleNone;
    [playercontroller.moviePlayer prepareToPlay];
    [playercontroller.moviePlayer play];
    playercontroller = nil;
Dhruv
  • 2,153
  • 3
  • 21
  • 45
vualoaithu
  • 936
  • 10
  • 9
0

You could subscribe to the MPMoviePlayerPlaybackStateDidChangeNotification notification and make sure the status bar is hidden as soon as playback starts.

Your handler would look something like that :

- (void)playbackStateDidChange:(NSNotification *)notification {
    MPMoviePlayerController *mpv = (MPMoviePlayerController *)notification.object;
    if (mpv.playbackState == MPMoviePlaybackStatePlaying) {
        [[UIApplication sharedApplication] setStatusBarHidden:YES];
    }
}
megastep
  • 1,246
  • 12
  • 13