I created an AVPlayerViewController and an attached AVPlayer in the viewDidAppear method of a custom UIViewController. Ho
I subclassed AVPlayerViewController and am posting a notification from viewWillDisappear to indicate dismissing of AVPlayerViewController.
- (void) viewWillDisappear:(BOOL)animated {
[[NSNotificationCenter defaultCenter] postNotificationName:kPlayerViewDismissedNotification object:nil];
[super viewWillDisappear:animated];
}
This might not be 100% correct (as it would fail if you have another view being displayed over AVPlayerViewController), but it worked for me as AVPlayerViewController is always at the top of the stack.