iphonempmovieplayercontrollermovies

Loading Multiple Movies in iPhone MPMoviePlayerController


-(void)initAndPlayMovie:(NSURL *)movieURL
{
    // Initialize a movie player object with the specified URL
    MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
    if (mp)
    {
        self.moviePlayer = mp;
        [mp release];
        [self.moviePlayer play];
    }
}

Here, in above code, We can pass just one movie URL. Isn't it possible to pass multiple urls to it?

So, Movie Player will load second url after playing first one.

Is it possible? How can we do that?

Right now, when I try to pass other url, after finishing first one.

- (void) moviePlayBackDidFinish:(NSNotification*)notification
{
    [self initAndPlayMovie:secondURL];
}

The Device First change its orientation while loading and after loading Device again come back to landscape mode.

How to resolve this problem?


Solution

  • You might want to change the orientation by changing the statusBar orientation before you start playing videos and change it back after you are done with all.

    [[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeRight animated:YES];