PiP not working on tvOS 14

Hi guys,

Based on the documentations looks like possible to implement Picture in Picture in tvOS on the same way as on iOS/iPadOS.

So, I tried to implement it yesterday but for some reasons when I'm calling "startPictureInPicture" it's not starting and I'm receiving "false" from "isPictureInPicturePossible"

Below the code that I used for setup PiP:

Code Block func setupPictureInPicture() {
        // Ensure PiP is supported by current device
        if AVPictureInPictureController.isPictureInPictureSupported() {
            // Create new controller passing reference to the AVPlayerLayer
            if let playerLayer = playerLayer {
                pictureInPictureController = AVPictureInPictureController(playerLayer: playerLayer)!
                pictureInPictureController.delegate = self
            }
        } else {
            // PiP not supported by current device. Disable PiP button.
            print("PIP NOT SUPPORTED BY CURRENT DEVICE")
        }
    }


Hi!

Did you setup your project with Background Audio and your audio session to .playback? From the doc for AVPictureInPictureController:

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 playback.

Also the video to help you get started with tvOS PiP is up today
Good luck!
I'm having a similar issue - AVPictureInPictureController.isPictureInPictureSupported() returns false.

Is this only working on hardware at the moment? (I have not had a chance to install the beta yet)

The same code (both our app, and the sample from the session) only work on the simulator with iPads.


Thanks
PiP not working on tvOS 14
 
 
Q