iPad SDK: How to hook to MPMOVIEPLAYERVIEWCONTROLLER’s finishing button?

I am creating an iPad add, I am using MPMoviePlayerViewController to play the video.

The video occupies the entire iPad screen.

playerViewController.view.frame = self.view.frame;

I need a way for the user to press a button to go to a different screen.

I noticed that when I create MPMoviePlayerViewController, a completion button is automatically displayed in the navigation controller.

My question:

a.) Anyway, hook the existing completion Button? Basically I just want to dismiss the view controller.

b.) If this doesn’t work. How can I add my own custom button? As mentioned above, MPMoviePlayerViewController occupies the entire screen. One of my ideas is to create MPMoviePlayerViewController in the frame and leave some vertical space so that I can add my own toolbar.

I prefer the suggestions on how to implement it. .)?

If this is not possible, maybe there are some suggestions on how to close MPMoviePlayerViewController by pressing a certain button?

All help appreciated.

From the documentation:

the Done button causes movie playback to pause while the player transitions out of fullscreen mode. If you want to detect this scenario in your code, you should monitor other notifications such as < code>MPMoviePlayerDidExitFullscreenNotification.

So, please try to observe this notification:

[[NSNotificationCenter defaultCenter] addObserver:self< br /> selector:@selector(moviePlayerDidExitFullscreen:)
name:MPMoviePlayerDidExitFullscreenNotification
object:nil];

Then:

 -(void)moviePlayerDidExitFullscreen:(NSNotification *)theNotification {
// do whatever you need to...
}

Edit: I think I misunderstood your question. You What I want is the method
-dismissMoviePlayerViewControllerAnimated

I assume you use -presentMov iePlayerViewControllerAnimated presents it:? You can use moviePlayer.navigationItem.rightBarButtonItem (or the left or any of them) to add a button. Set the target of this button to the view controller, and intercept the operation to call -dismiss…

I am creating an iPad add, I am using MPMoviePlayerViewController to play the video.

The video occupies the entire iPad screen.

playerViewController.view.frame = self.view.frame;

I need a way for the user to press a button to go to a different screen.

I noticed that when I created When MPMoviePlayerViewController, a complete button is automatically displayed in the navigation controller.

My question:

a.) Is there anyway to hook the existing complete button? Basically I just want to dismiss the view controller.

b.) If this doesn’t work. How can I add my own custom button? As mentioned above, MPMoviePlayerViewController occupies the entire screen. One of my ideas is to create MPMoviePlayerViewController in the frame and leave some vertical space so that I can add my own toolbar.

I prefer the suggestions on how to implement it. .)?

If this is not possible, maybe there are some suggestions on how to close MPMoviePlayerViewController by pressing a certain button?

All help appreciated.

From the documentation:

< p>the Done button causes movie playback to pause while the player transitions out of fullscreen mode. If you want to detect this scenario in your code, you should monitor other notifications such as MPMoviePlayerDidExitFullscreenNotification.

So, please try to observe this notification:

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayerDidExitFullscreen:)< br /> name:MPMoviePlayerDidExitFullscreenNotification
object:nil];

Then:

- (void)moviePlayerDidExitFullscreen:(NSNotification *)theNotification { 
// do whatever you need to...
}

Edit: I think I misunderstood your question. What you want is the method
-dismissMoviePlayerViewControllerAnimated p>

I assume you use -presentMoviePlayerViewControllerAnimated to present it:? You can use moviePlayer.navigationItem.rightBarButtonItem (or left or any of them) to add a button. Set the target of this button to the view controller and intercept the operation to call -dismiss…

Leave a Comment

Your email address will not be published.