Instance Method

playerViewController(_:restoreUserInterfaceForPictureInPictureStopWithCompletionHandler:)

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

Declaration

optional func playerViewController(_ playerViewController: AVPlayerViewController, restoreUserInterfaceForPictureInPictureStopWithCompletionHandler completionHandler: @escaping (Bool) -> Void)

Parameters

playerViewController

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

completionHandler

For the user interface to be restored, you must implement your method to return a value of true in this block.

Discussion

Implement this method to reestablish your movie playback user interface when PiP ends. This method is called no matter how PiP ends, whether it is because the user ended playback, the user tapped the button to return ongoing video playback to your app, or the video finished playing on its own.

See Also

Managing Your App’s UI for Picture in Picture

func playerViewControllerShouldAutomaticallyDismissAtPictureInPictureStart(AVPlayerViewController) -> Bool

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