Search code examples
iosavfoundationmpmovieplayercontrollermpmovieplayer

MPMoviePlayer stuck on "loading..."


I am initializing a new MPMoviePlayerViewController with an URL to play fullscreen video from a server. After the player screen appears, it stucks on "Loading...", but no actual loading is taking place, cause there is no network communication at all for some reason. I use this code:

- (IBAction)playerButtonPressed:(id)sender {
    NSURL *url = [NSURL URLWithString:
                  @"http://ebookfrenzy.com/ios_book/movie/movie.mov"];

    MPMoviePlayerViewController *c = [[MPMoviePlayerViewController alloc]
                                      initWithContentURL:url];

    [self presentMoviePlayerViewControllerAnimated:c];
}

URL is correct and this what I get:
enter image description here


Solution

  • Your code works perfectly on my machine. The problem is not reproducible.

    Perhaps in your case something is stopping the Simulator from making a network connection. It might be LittleSnitch; the network might be down; there are lots of possibilities.

    You are effectively tunneling the Simulator's networking through your computer's networking. I suggest that you run the code on a device rather than the Simulator, in order to avoid this complication.