PiP works on iPhone but not iPad

Viewed 873

In iOS 14, when I set up an AVPlayerViewController, and set the player's delegate, if I press the home button on an iPhone, the delegate function playerViewControllerDidStartPictureInPicture gets called and I can see the PiP on the phone's home screen. However, in the same app, if I press the home button on an iPad, that delegate method does not get called, and PiP doesn't start.

Is there anything I could possibly be missing? Is there a way to programmatically activate PiP? The goal is to show PiP on iPad when the user presses the home button.

This is what the code looks like:

                let videoURL = URL(string: url)!
                let player = AVPlayer(url: videoURL)
                playerView = AVPlayerViewController()
                guard let playerView = playerView else { return }

                playerView.player = player
                playerView.delegate = self
                playerView.allowsPictureInPicturePlayback = true
0 Answers
Related