A controller that responds to user-initiated Picture in Picture playback of video in a floating, resizable window.
Mac Catalyst 13.0+
Your app is responsible for providing a button for the user to tap to invoke Picture in Picture playback. Before displaying the button, call the isPictureInPictureSupported() method to determine if the user’s device supports the feature, and check the isPictureInPicturePossible property to determine whether PiP is possible in the current context.
To participate with Picture in Picture in iOS, take the following steps in your Xcode project:
In the Xcode Capabilities view for your project, select Audio and AirPlay in the Background Modes section.
Configure your audio session with an appropriate category, such as playback.
Creating and Configuring a Picture in Picture Controller
Stops Picture in Picture playback, if it’s 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 images found in the user interface provided by AVPlayerViewController.
This sample code project demonstrates techniques for tracking AVPlayerViewController presentation state across multiple application scenarios, including being displayed fullscreen, embedded inline, or as Picture in Picture.