AVPlayerViewController lot different than using MPMoviePlayerViewController . Instead of using notifications, you use Key Value Observing to determine the current characteristics of the AVPlayer object associated with the AVPlayerViewController . According to the docs:
You can monitor the player’s status using key monitoring. So that you can safely add and remove observers, AVPlayer serializes notifications of changes that occur dynamically during playback on the send queue. By default, this queue is the main queue (see dispatch_get_main_queue). To provide secure access to players non-atomic properties, while dynamic changes in the playback state may be reported, you must serialize access with notification to the recipients queue. In the general case, such serialization is naturally achieved by calling AVPlayers various methods in the main thread or queue.
For example, if you want to know when your player is paused, add an observer to the rate property of the AVPlayer object:
[self.player addObserver:self forKeyPath:@"rate" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld context: &PlayerRateContext];
Then, in the observation method, verify that the new value is zero:
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSString *,id> *)change context:(void *)context { if (context == &PlayerRateContext) { if ([[change valueForKey:@"new"] integerValue] == 0) {
There are many properties on AVPlayer . Go to Class Link .
In addition, there are several notifications available for the AVPlayerItem object, which are limited but still useful.
Notifications
AVPlayerItemDidPlayToEndTimeNotification
AVPlayerItemFailedToPlayToEndTimeNotification
AVPlayerItemTimeJumpedNotification
AVPlayerItemPlaybackStalledNotification
AVPlayerItemNewAccessLogEntryNotification
AVPlayerItemNewErrorLogEntryNotification
I find AVPlayerItemDidPlayToEndTimeNotification particularly useful for finding an item at the beginning after playback is completed.
Using these two options together, you can replace most, if not all, notifications for MPMoviePlayerController