Playing multiple Videos using MPMoviePlayerController

In my app i have multiple Videos and i want that when the user press the next or previous button in the MPMoviePlayerController, the MPMoviePlayerController should the particular song.But the problem is that the MPMoviePlayerController has only the notification for the SeekingForward or for Backward. How to implement the previous and next functionality using the FastForward and the BackWard Button inside the MPMoviePlayerController.

  • XCode iO6: UIWebView Returns Black Screen After Returning from Choosing a Photo
  • objective C underscore property vs self
  • iTunesArtwork and XCode
  • Swift Assertions behaviour in production applications
  • Phillips HUE SDK in Swift
  • Core Data Transformable NSArray of IDs
  • Solutions Collect From Internet About “Playing multiple Videos using MPMoviePlayerController”

    Apple introduced new class Called AVQueuePlayer using this you can play many videos at a time this class is worth using then MPMoviePlayerController which not support playing multiple movies.

    AVQueuePlayer is avalible from IOS 4.1 and above it is subclass AVPlayer. If u familiar with AVPlayer

    You can change current running movie with call

    [self.queuePlayer advanceToNextItem];

    You can look at the sample code here

    You can download the sample application from here

    Another Idea (worst case).

    Register for the notification with

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayerPlaybackStateChanged:) name:MPMoviePlayerPlaybackStateDidChangeNotification object:nil];

    And add this function to your object:

    -(void)moviePlayerPlaybackStateChanged:(NSNotification *)notification {
        MPMoviePlayerController *moviePlayer = notification.object;
        MPMoviePlaybackState playbackState = moviePlayer.playbackState;
        // ...

    I suspect you’ll find that you’re getting MPMoviePlaybackStateSeekingForward and …SeekingBackward updates for those buttons.

    See the details here

    And set the corresponding URL’s for the MPMoviePlayerController or initialize again the MPMoviePlayerController with the corresponding URL’s.