Timur Mustafaev
Timur Mustafaev

Reputation: 4929

MPMoviePlayerViewController notifications

How to set notifications to MPMoviePlayerViewController? Is it the same as in MPMoviePlayerController?

Show example please

Upvotes: 2

Views: 8416

Answers (1)

Faizan S.
Faizan S.

Reputation: 8644

The MPMoviePlayerViewController is just a wrapper giving you controls to a MPMoviePlayerController.

MPMoviePlayerViewController has its own MPMoviePlayerController that sends all the notifications you need to work with it.

Listening to notifications is done as follows:

// Register for the playback finished notification
[[NSNotificationCenter defaultCenter] addObserver:self // the object listening / "observing" to the notification
    selector:@selector(myMovieFinishedCallback:) // method to call when the notification was pushed
    name:MPMoviePlayerPlaybackDidFinishNotification // notification the observer should listen to
    object:self.moviePlayerViewController.moviePlayer]; // the object that is passed to the method

There are a lot more notifications you can and should work with that are listed in the MPMoviePlayerController Class Reference

So basically, yes - You can use the same notifications as in MPMoviePlayerController

Upvotes: 16

Related Questions