Search code examples
iosiphonempmovieplayercontroller

how to show MPMoviePlayer done button when video is playing?


I want to play video in MPMoviePlayerViewController, it works fine and plays video but problem is that it does not show done button unless i switch to the full screen mode. It should automatically show player along with done button as shown in attached screen.enter image description here

here is the code:

   mp = [[MPMoviePlayerViewController alloc] initWithContentURL:myURL];
    [[mp moviePlayer] prepareToPlay];
    [[mp moviePlayer] setUseApplicationAudioSession:NO];
    [[mp moviePlayer] setShouldAutoplay:YES];
    [[mp moviePlayer] setControlStyle:2];
    [self presentMoviePlayerViewControllerAnimated:mp];

Solution

  • Done button will be visible only when video is played in full screen mode. So, either you need to play the video in full screen mode using the following code:

    player.moviePlayer.fullscreen = YES;
    

    Or you need to customise the control to add your own Done button.