An AVPictureInPictureController lets you respond to user-initiated playback of video in a floating, resizable window on iPad.
When you use this class, your app is responsible for providing a button for the user to tap to invoke the Picture in Picture feature with your content. Before displaying the button, call the isPictureInPictureSupported() method to determine if the user’s iPad supports the feature, and check the isPictureInPicturePossible property to determine whether PiP is possible in the current context.
To participate with Picture in Picture, take the following steps in your Xcode project:
Link on or after iOS 9.0.
In the Xcode Capabilities view for your project, select Audio and AirPlay in the Background Modes section.
Stops Picture in Picture for the associated AVPlayerLayer instance, if it is currently active.
Retrieving Picture in Picture Template Images
You can use the following methods to retrieve system default images to start and stop Picture in Picture playback in your custom player interface. The images returned match the ones found in the user interface provided by AVPlayerViewController.