Instance Method

playerViewControllerShouldAutomaticallyDismissAtPictureInPictureStart(_:)

Allows you to opt out from the player view controller automatically dismissing when Picture in Picture (PiP) starts.

Declaration

optional func playerViewControllerShouldAutomaticallyDismissAtPictureInPictureStart(_ playerViewController: AVPlayerViewController) -> Bool

Parameters

playerViewController

The player view controller to which you’ve assigned the delegate.

Return Value

A Boolean value that indicates whether the player view controller should automatically dismiss when PiP starts. Default value is true, indicating that the player view controller does automatically dismiss.

Discussion

To prevent the player view controller from automatically dismissing when Picture in Picture starts, implement this method and return false. If you return false, the player view controller remains in the app’s view hierarchy and displays the background color, along with a system-defined message that tells the user the video is now playing in Picture in Picture.

See Also

Managing Your App’s UI for Picture in Picture

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

Gives your app an opportunity to restore its movie playback user interface; called when Picture in Picture is about to stop.