Class

AVPictureInPictureController

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

Declaration

@interface AVPictureInPictureController : NSObject

Overview

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

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

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

Topics

Creating and Configuring a Picture in Picture Controller

- initWithPlayerLayer:

Creates a new Picture in Picture controller.

delegate

The Picture in Picture controller’s delegate object.

AVPictureInPictureControllerDelegate

The protocol that defines the methods to respond to Picture in Picture events.

playerLayer

The player layer that displays the media to play.

Accessing Picture in Picture State

+ isPictureInPictureSupported

Returns a Boolean value that determines whether the current device supports Picture in Picture playback.

pictureInPicturePossible

A Boolean value that indicates whether 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 system suspended the controller’s Picture in Picture window.

Controlling Picture in Picture Playback

- startPictureInPicture

Starts Picture in Picture playback, if possible.

- stopPictureInPicture

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.

pictureInPictureButtonStartImage

The system default Picture in Picture start template image for use in an app’s Picture in Picture button.

pictureInPictureButtonStopImage

The system default Picture in Picture stop template image for use in an app’s Picture in Picture button.

+ 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 (PiP) playback to your app using a player view controller.

Adopting Picture in Picture in a Custom Player

Add controls to your custom player user interface to invoke Picture in Picture (PiP) playback.

Working with Interstitial Content in tvOS

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

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

A view controller 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.

AVInterstitialTimeRange

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

AVNavigationMarkersGroup

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