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.
-
1I would start investigating `AVPlayer` and `AVPlayerLayer` with a custom UI. `MPMoviePlayerController` is very difficult to customize the way you want. – Jonathan Grynspan Aug 06 '12 at 06:56
1 Answers
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.

- 1
- 1

- 30,739
- 9
- 69
- 102
-
Thanx for your help. but i want that when user tap the fastforwad button, MPMoviePlayerController will play the next video. and when the user tap the fastback button , the MPMoviePlayerController will play the previous video. – Fahad Jamal Aug 06 '12 at 07:39
-