Next/Previous buttons on iPhone MPMoviePlayerController
10,058
No notifications are generated when the user presses the next/previous buttons (you should file a bug about that), so the only way to solve this without any unapproved view-crawling is to implement your own video overlay view:
MPMoviePlayerController* moviePlayer = [[MPMoviePlayerController alloc]
initWithContentURL:someUrl];
moviePlayer.movieControlMode = MPMovieControlModeHidden;
[moviePlayer play];
NSArray* windows = [[UIApplication sharedApplication] windows];
if ([windows count] > 1) {
UIWindow *moviePlayerWindow = [[UIApplication sharedApplication] keyWindow];
[moviePlayerWindow addSubview:yourCustomOverlayView];
}
Not ideal, but the standard controls are quite easy to re-implement.
Comments
-
David Salzer almost 2 years
When using the MPMoviePlayerController, the play button is surrounded with "Next" and "Previous" buttons.
How do I get notifications when they are clicked? is there a way to feed MPMoviePlayerController with a list (array) of content?
-
David Salzer almost 15 yearsI guess you are right. And yet, why these controls are there anyway? On the youTube application - they do move to the next/prev video.
-
Stefan Arentz almost 15 yearsOn the iPhone they go to the start or end of the current movie. They are not next/prev buttons.
-
David Salzer almost 15 yearsThat is incorrect. When you implement am MPMoviePlayerController - they just exit the player in the same way "stop" would do.
-
David Salzer almost 15 yearsThis code is not removing the existing overlay layer. did you mean to add a clear button on them?
-
Nathan de Vries almost 15 years@yn2: I've updated my answer so that the default overlay UI is hidden.