Skip to content
Product Documentation

Enable Picture-in-Picture for Native and Custom AVPlayers (iOS)

Native Video Players

Take the following steps to enable Picture-in-Picture for native AVPlayers:

  1. Go to your application project’s Signing & Capabilities view.

  2. If you don’t already have Background Modes available, click the + button to add that section.

  3. Under Background Modes, add a checkmark to Audio, Airplay, and Picture in Picture.

  4. Call the following function to enable a background session:

    PictureInPictureManager.activatePictureInPictureSession()

The function starts a Picture-in-Picture session when backgrounding your application.

Custom Players

After completing the steps for native AVPlayers, take the following additional steps:

  1. Locate where your custom player is being managed.

  2. Call PictureInPictureManager’s setup function.

  3. Provide the associated AVPlayer and UIViewController instances:

    PictureInPictureManager.setUp(with: AVPlayer, for: viewController)

Now you must be able to dismiss the application and see your video player enter Picture-in-Picture mode the same way it does for the native player.