Hide StatusBar from MPMoviePlayerController

I've been struggling with a very annoying problem all day long and I hope I could find help on this board.

I'm using an MPMoviePlayerController to play a fullscreen movie on iPad and I can't figure how to remove the status bar which is always displayed despite all my efforts to make it go to hell.

Here is the code of the method I use to display the movie :


         NSString *videoPath = [[NSBundle mainBundle] pathForResource:@"movie01" ofType:@"m4v"];
         NSURL *videoPathURL = [NSURL fileURLWithPath:videoPath];
         moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:videoPathURL];

         [self.view addSubview:moviePlayer.view];

         moviePlayer.shouldAutoplay = YES;
         moviePlayer.movieSourceType = MPMovieSourceTypeFile;

         [moviePlayer setFullscreen:YES animated:YES];
         moviePlayer.controlStyle = MPMovieControlStyleFullscreen;

         NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
         [notificationCenter addObserver:self selector:@selector(moviePlayerEvent:) name:MPMoviePlayerLoadStateDidChangeNotification object:moviePlayer];



         [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];
         NSLog(@"%i", [UIApplication sharedApplication].statusBarHidden);


In the console, I can see that moviePlayerEvent is fired when the movie appears but the statusbar is still there : [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO] seems to be inoperant. I've been trying to use the other MPMoviePlayerController notifications with no luck.

Could anyone help me on that one?

Thanks in advance.


Unfortunately, after running into this very problem, through research and much experimentation, I've determined that it is pretty much impossible to keep the iOS status bar hidden in full screen mode. No matter what you do, when the full screen player controls are shown, so will the status bar (it will not respect the setStatusBarHidden:YES). This is not the case with the embedded player controls, but the user can easily switch between embedded and full screen modes, so you can't really use this to maintain no status bar when the controls are shown.

Of course, at least the status bar goes away when the controls fade out...

Do not add the movie player's view to your main view; instead, present the movie player modally as follows (some steps omitted for brevity/clarity):

moviePlayerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:url];

// Register for the playback finished notification.
    [[NSNotificationCenter defaultCenter] addObserver:self

    [self presentMoviePlayerViewControllerAnimated:moviePlayerViewController];

    // Play the movie!
    self.moviePlayerViewController.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
    [self.moviePlayerViewController.moviePlayer play];

// When the movie is done, release the controller.

    //NSLog(@"playback terminated");

    [[NSNotificationCenter defaultCenter] removeObserver:self

    [moviePlayerViewController release], moviePlayerViewController = nil;


It worked for me to use MPMoviePlayerViewController, setting up the following

[moviePlayerController.moviePlayer setFullscreen:YES animated:NO];
moviePlayerController.moviePlayer.controlStyle = MPMovieControlStyleFullscreen;

before this:

[self presentViewController:moviePlayerController animated:NO completion:^{ }];

and the following right after:

moviePlayerController.moviePlayer.controlStyle = MPMovieControlStyleNone;

just in case, I also did this:

[[NSNotificationCenter defaultCenter] addObserver:self
                                                 name:MPMoviePlayerLoadStateDidChangeNotification object:nil];


- (void)moviePlayerLoadStateDidChange:(NSNotification *)notification {

    if ([[moviePlayerController moviePlayer] loadState] == MPMovieLoadStateStalled) {

    } else if([[moviePlayerController moviePlayer] loadState] != MPMovieLoadStateUnknown) {

        [moviePlayerController moviePlayer].controlStyle = MPMovieControlStyleNone;


So, no status bars, no controls... nothing but only a pure video. )

(Tested on iOS 5.1 device and 6.0 simulator).

The status bar did hided, but showing up again with the play control.

        [super viewDidLoad];
        MPMoviePlayerViewController *moviePlayerViewController =
                [[MPMoviePlayerViewController alloc] initWithContentURL:videoURL];

        [[NSNotificationCenter defaultCenter] addObserver:self 
        if([[UIApplication sharedApplication]respondsToSelector:@selector(setStatusBarHidden: withAnimation:)])
        [[UIApplication sharedApplication] setStatusBarHidden:YES 
            [[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];

Using MPMovieControlModeVolumeHidden didn't work for me, the only one that worked was MPMovieControlModeVolumeOnly with the video in fullscreen:

myMoviePlayer.controlStyle = MPMovieControlModeVolumeOnly;
[myMoviePlayer setFullscreen:YES];

And also, I am adding the movie view as a subview to the parent view:

[parentView addSubview:myMoviePlayer.view];

My app is supposed to not have status bar and for backwards compatibility I use the following code on the app delegate:

if([[UIApplication sharedApplication] respondsToSelector:@selector(setStatusBarHidden: withAnimation:)])
    [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
    [[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];

this is not an answer, I am having the same issue. There is one part I can update however..

The status bar only shows when the controls show.

Clicking on the movie, hides the conrols & the status bar, clicking again, shows the controls, and the status bar comes back too.

I am also hiding the status bar programmatically just before I launch the movie.

[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];

and here is how I am adding the movie:

[[[UIApplication sharedApplication] keyWindow] addSubview: movieView];

For those that have been running into this issue, I've found a solution of my own that might help. It only applies though if the rest of your app does not show the status bar and if you are trying to hide it again once the movie is done and returning to your interface, instead of during playback.

If your MPMoviePlayerController is being added as a subview to a UIView that is being pushed onto a navigation controller view stack, you can use that parent view controller's viewWillDisappear method to help you out.

In that method, you can change the control style to none, which will clear out any and all movie player controls before the view disappears and clears the status bar out as well if you already had it set to hidden. This will be completely unapparent to the user as the view is moving off screen and they are no longer interacting with it.

I had the same problem but I added to my info.plist row Status bar is initially hidden - Boolean - YES and it works! BTW I'm using iOS 5.1, Xcode 4.3.2.

I don't know if my solution applies to your issue, but it works for my setup, i.e. 4th gen ipod running iOS 5.1.

My applications does not show the status bar at all, and in the info.plist file the corresponding entry "Status bar is initially hidden" is set to YES.

I also directly add the MPMoviePlayerController view to its parent view. Here is the code to setup the movie player:

moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:theurl];
[moviePlayer.view setFrame:frame]; // This is set to (0, 0, 320, 480)
[moviePlayer prepareToPlay];
[moviePlayer setShouldAutoplay:YES]; 
moviePlayer.fullscreen = TRUE;
moviePlayer.controlStyle = MPMovieControlStyleFullscreen;
[self.view addSubview:moviePlayer.view];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playBackFinished:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer]; 

The moviePlayer is a class variable.

When the player finishes playing or when the viewer presses the "Done" button of the moviePlayer controller, the playbackFinished: method is called:

- (void)playBackFinished:(NSNotification *)notif{
moviePlayer.controlStyle = MPMovieControlStyleNone;
[moviePlayer stop];
[moviePlayer.view removeFromSuperview];

[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer];
[moviePlayer release];
moviePlayer = nil;

In which the control style of the moviePlayer is set to MPMovieControlStyleNone to prevent any controls, but essentially the status bar from showing up when the moviePlayer is removed from its parent view.

Need Your Help

How to understand this define

c linux syntax function-declaration

Nowadays , i was reading the APUE.and i found the function defined as below:

Adding gif image in an ImageView in android

android imageview gif

I added an animated gif image in an imageView. I am not able to view it as a gif image. No animation is there. It's appearing just as a still image. I would like to know how can i show it as a gif ...