Protocol

AVPlayerViewControllerDelegate

A protocol that defines the methods to implement to respond to media playback events associated with a player view controller.

Declaration

protocol AVPlayerViewControllerDelegate

Topics

Dismissing the Player View Controller

func playerViewControllerShouldDismiss(AVPlayerViewController) -> Bool

Asks the delegate object whether the player view controller should dismiss itself.

func playerViewControllerWillBeginDismissalTransition(AVPlayerViewController)

Tells the delegate that the player view controller will begin its dismissal transition.

func playerViewControllerDidEndDismissalTransition(AVPlayerViewController)

Tells the delegate that the player view controller did end its dismissal transition.

Managing Your App’s Picture in Picture Behavior

func playerViewControllerShouldAutomaticallyDismissAtPictureInPictureStart(AVPlayerViewController) -> Bool

Asks the delegate whether the player view controller should automatically dismiss when Picture in Picture starts.

func playerViewController(AVPlayerViewController, restoreUserInterfaceForPictureInPictureStopWithCompletionHandler: (Bool) -> Void)

Tells the delegate that Picture in Picture is about to stop and you should restore your user interface.

Responding to Picture in Picture Lifecycle Events

func playerViewControllerWillStartPictureInPicture(AVPlayerViewController)

Tells the delegate that Picture in Picture is about to start.

func playerViewControllerDidStartPictureInPicture(AVPlayerViewController)

Tells the delegate that Picture in Picture has started.

func playerViewControllerWillStopPictureInPicture(AVPlayerViewController)

Tells the delegate that Picture in Picture is about to stop.

func playerViewControllerDidStopPictureInPicture(AVPlayerViewController)

Tells the delegate that Picture in Picture has stopped.

Responding to Navigation Events

func playerViewController(AVPlayerViewController, timeToSeekAfterUserNavigatedFrom: CMTime, to: CMTime) -> CMTime

Tells the delegate that the user has skipped, scrubbed, or otherwise navigated to a new time and wants to resume playback at the target time.

func playerViewController(AVPlayerViewController, willResumePlaybackAfterUserNavigatedFrom: CMTime, to: CMTime)

Tells the delegate the user has skipped, scrubbed, or otherwise navigated to a new time, and playback is about to start at the new time.

func skipToPreviousItem(for: AVPlayerViewController)

Tells the delegate that the user requested skipping to the previous item in the timeline.

func skipToNextItem(for: AVPlayerViewController)

Tells the delegate that the user requested skipping to the next item in the timeline.

Responding to Interstitial Content Playback Events

func playerViewController(AVPlayerViewController, willPresent: AVInterstitialTimeRange)

Tells the delegate that the player view controller will begin playing a range of interstitial content.

func playerViewController(AVPlayerViewController, didPresent: AVInterstitialTimeRange)

Tells the delegate that the player view controller has completed playing a range of interstitial content.

Responding to Content Proposals

func playerViewController(AVPlayerViewController, shouldPresent: AVContentProposal) -> Bool

Asks the delegate whether the player view controller should present a content proposal.

func playerViewController(AVPlayerViewController, didAccept: AVContentProposal)

Tells the delegate that the user accepted the presented content proposal.

func playerViewController(AVPlayerViewController, didReject: AVContentProposal)

Tells the delegate that the user rejected the presented content proposal.

Responding to Media Selection

func playerViewController(AVPlayerViewController, didSelect: AVMediaSelectionOption?, in: AVMediaSelectionGroup)

Tells the delegate that the user has selected a media option from a media selection group.

Responding to Transport Bar Changes

protocol AVPlayerViewControllerAnimationCoordinator

Methods to implement to add animations synchronized with the playback controls' visibility animation.

Responding to Channel Changes

func playerViewController(AVPlayerViewController, skipToNextChannel: (Bool) -> Void)

Tells the delegate that the user wants to skip to the next channel.

func playerViewController(AVPlayerViewController, skipToPreviousChannel: (Bool) -> Void)

Tells the delegate that the user wants to skip to the previous channel.

func nextChannelInterstitialViewController(for: AVPlayerViewController) -> UIViewController

Asks the delegate for a view controller describing the layout of the next channel interstice.

func previousChannelInterstitialViewController(for: AVPlayerViewController) -> UIViewController

Asks the delegate for a view controller describing the layout of the previous channel’s interstitial view.

Responding to Full Screen Presentations

func playerViewController(AVPlayerViewController, willBeginFullScreenPresentationWithAnimationCoordinator: UIViewControllerTransitionCoordinator)

Tells the delegate that the player view controller is about to start displaying its contents full screen.

func playerViewController(AVPlayerViewController, willEndFullScreenPresentationWithAnimationCoordinator: UIViewControllerTransitionCoordinator)

Tells the delegate that the player view controller is about to end displaying its contents full screen.

Relationships

Inherits From

See Also

Accessing the Delegate Object

var delegate: AVPlayerViewControllerDelegate?

The player view controller’s delegate object.