Mayank Patel
Mayank Patel

Reputation: 3908

Status bar overlaps Navigation Bar : MPMoviePlayerController

I am using MPMovieplayer as subview everything works fine but my issue is when i click on full screen video then coming back to small video frame then status bar overlaps navigation bar

Here's my code

// Setup player
MPMoviePlayerController* mp =
[[MPMoviePlayerController alloc] initWithContentURL:videoURL];
mpc = mp;
mpc.shouldAutoplay = YES;
[mpc prepareToPlay];
mpc.view.frame = CGRectMake(0, 0, 320, 320);

mpc.backgroundView.backgroundColor = [UIColor redColor];
[self.view addSubview:mpc.view];

enter image description here

Upvotes: 1

Views: 401

Answers (2)

Mayank Patel
Mayank Patel

Reputation: 3908

I have solved by doing adding the key in .plist file

'View controller-based status bar appearance' and set to NO.

then set the statusbar hidden to NO

Upvotes: 1

Bhadresh Mulsaniya
Bhadresh Mulsaniya

Reputation: 2640

/* Create a new movie player object. */
    MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];

    if (player)
    {
        /* Save the movie object. */
        [self setMoviePlrController:player];

        /* Register the current object as an observer for the movie
         notifications. */
        [self installMovieNotificationObservers];

        /* Specify the URL that points to the movie file. */
        [player setContentURL:movieURL];

        /* If you specify the movie type before playing the movie it can result
         in faster load times. */
        [player setMovieSourceType:sourceType];
        [player setRepeatMode:MPMovieRepeatModeNone];
        player.scalingMode = MPMovieScalingModeAspectFit;

        // Apply the user movie preference settings to the movie player
        [self.moviePlrController.view setAutoresizingMask:(UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth)];
        [self.playerView addSubview:[self moviePlrController].view];
        CGRect frame = self.playerView.frame;
        int width = frame.size.width;
        int height = frame.size.height;



        [[self moviePlrController].view setFrame:CGRectMake(0, 0, width, height)];
    }

Upvotes: 0

Related Questions