views:

402

answers:

1

I want to add an overlay view for my video when the video is paused by the user. Is there any way to get the pause notification from MPMoviePlayerController?

According to Apple Doc, there should be ways to do this but I can't find which notification should I use for this purpose.

Quote:

In addition to being notified when playback finishes, interested clients can be notified in the following situations:

-When the movie player begins playing, is paused, or begins seeking forward ... For more information, see the Notifications section in this reference.

+2  A: 

I assume you know about delegates and protocols as a means of receiving callbacks?

There's another global mechanism called notifications too.

You can do this via

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

Then, within playbackStateChanged, you can fetch the playbackState

 - (void) playbackStateChanged {

   _player.playbackState; // reading the playback

 }

The step of reading playbackstate directly from the player is specified in the docs

To get the current playback state, get the value of the playbackState property of the movie player object.

CVertex