Class

AVPictureInPictureController

A controller that responds to user-initiated playback of video in a floating, resizable window on iPad.

Declaration

@interface AVPictureInPictureController : NSObject

Overview

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 pictureInPicturePossible 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:

  1. Link on or after iOS 9.0.

  2. In the Xcode Capabilities view for your project, select Audio and AirPlay in the Background Modes section.

  3. Configure your audio session with an appropriate category, such as AVAudioSessionCategoryPlayback.

Topics

Creating and Configuring a Picture in Picture Controller

- initWithPlayerLayer:

The designated initializer for a Picture in Picture controller.

delegate

The delegate object for the Picture in Picture controller.

AVPictureInPictureControllerDelegate

Methods you can implement to configure your app’s user interface to respond to user interactions for Picture in Picture on iPad.

playerLayer

The AVPlayerLayer instance containing the media to play.

Accessing Picture in Picture State

+ isPictureInPictureSupported

Indicates whether Picture in Picture is supported on the current device.

pictureInPicturePossible

A Boolean value that indicates whether the Picture in Picture playback is currently possible.

pictureInPictureActive

A Boolean value that indicates whether the controller’s Picture in Picture window is onscreen.

pictureInPictureSuspended

A Boolean value that indicates whether the controller’s Picture in Picture window is suspended.

Controlling Picture in Picture Playback

- startPictureInPicture

Starts Picture in Picture for the associated AVPlayerLayer instance, if possible.

- stopPictureInPicture

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 images found in the user interface provided by AVPlayerViewController.

+ pictureInPictureButtonStartImageCompatibleWithTraitCollection:

Returns the system default Picture in Picture start template image for use in your player’s Picture in Picture button.

+ pictureInPictureButtonStopImageCompatibleWithTraitCollection:

Returns the system default Picture in Picture stop template image for use in your player’s Picture in Picture button.

Relationships

Inherits From

See Also

Media Playback

Adopting Picture in Picture in a Standard Player

Add picture-in-picture controls to your player using a player view controller.

Adopting Picture in Picture in a Custom Player

Add picture-in-picture controls to your custom player using a picture-in-picture controller.

Working with Interstitial Content (tvOS)

Present additional content such as legal text, content warnings, or advertisements alongside your main media content.

Adopting Custom Interactive Overlays, Channel Flipping, and Parental Controls in tvOS Video Playback

This sample demonstrates support for custom interactive overlays, and parental controls, using AVPlayerViewController.

Adding Information to the Info Panel (tvOS)

Add metadata information and navigation markers to the Info panel in Apple TV.

AVPlayerViewController

An object that displays the video content from a player object along with system-supplied playback controls.

AVPlayerView

A macOS-only object that displays the video content from a player object along with system-supplied playback controls.

AVRoutePickerView

An object that displays controls for picking playback routes.

AVInterstitialTimeRange

A time range in an audiovisual presentation as interstitial content, such as advertisements or legal notices.

AVNavigationMarkersGroup

A set of markers for navigating playback of an audiovisual presentation.