Instance Method

pictureInPictureController(_:restoreUserInterfaceForPictureInPictureStopWithCompletionHandler:)

Tells the delegate when Picture in Picture is about to stop, to give your app an opportunity to restore its video playback user interface.

Declaration

optional func pictureInPictureController(_ pictureInPictureController: AVPictureInPictureController, restoreUserInterfaceForPictureInPictureStopWithCompletionHandler completionHandler: @escaping (Bool) -> Void)

Parameters

pictureInPictureController

The Picture in Picture controller to which you’ve assigned the delegate.

completionHandler

To allow the system to finish restoring your user interface, you must call the completion handler with a value of true.

Discussion

Implement this method to reestablish your video 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