Continue playing movie in MPMoviePlayerViewController in background

I have an MPMoviePlayerViewController that plays a movie in my app.

Multitasking is enabled so that I can return to the home screen or lock the device and then use the music controls to continue playing audio. The problem is the fact that audio is stopped when the app loses focus, so that you have to manually press play to start it again.

  • Formatting UITextField's text as Phone Number as user types in
  • How to get a CNContact phone number(s) as string in Swift?
  • Allowing single digit in UITextField in iOS
  • Are @property(nonatomic)ivar @property(nonatomic,assign)ivar the same or different?
  • Convert date in MM/dd/yyyy format in xcode?
  • UITableViewCell load images and reused cells
  • The default music app, of course, and some others such as Ambiance continue playing audio in the background however these only ever play audio whereas my app’s audio source is a video – is it possible to keep playing when losing focus from a MPMoviePlayerViewController?

    Solutions Collect From Internet About “Continue playing movie in MPMoviePlayerViewController in background”

    This works for me.
    Load a false url when video player done button pressed.
    For Example

     [[NSNotificationCenter defaultCenter] addObserver:self

    and implement

    - (void)moviePlaybackComplete:(NSNotification *)notification
        self.playerViewController=[self.playerViewController initWithContentURL:[NSURL URLWithString:@"dummyUrl"]];
        [self.playerViewController.moviePlayer stop];
        MPMoviePlayerViewController *moviePlayerController = [notification object];
        [[NSNotificationCenter defaultCenter] removeObserver:self

    This works just fine.