iPadOS Picture-In-Picture automatically invoking when backgrounding App

We're currently seeing a new behavior in our iOS app (not fully iPadOS compatible yet, but does support basic pre-iOS 13 multitasking).


We have a screen that has an autoplaying video on it - This video is intentionally not available for PiP mode (we manually disable the button for it)


However, with the new iPadOS, even though we've disabled the direct interaction to enable PiP, when we background the app the video goes into PiP mode automatically.


This was not occuring in iOS 12.


Is this behavior change new to iPadOS? Is this something we can disable manually if it is?


I'm concerned about this because of the note on AVPictureInPicture's documentation:


"Note

Picture in Picture (PiP) is a user feature that Apple intends to always be under user control. Invoke PiP only in response to a user’s explicit request to do so. If an app invokes PiP in a way that is not under the immediate direction of the user, it will be rejected by the App Store."


Since there's no interaction on the user's part, this is unexpected behavior. We have not made any code changes around this feature.

)By default, all iOS applications that support background mode and support video with PiP will auto transition to PiP when you background the app. (https://developer.apple.com/videos/play/wwdc2015/211/)


You have to explicitly tell the framework you do not want PiP available, by setting '.allowsPictureInPicturePlayback' to false on your AVPlayerViewController or your AVPlayerLayer (whichever you use)

That property is only available on AVPlayerViewController, which we're not using so it's not useful for us in this situation.


I wasn't clear in my original post but the player we have on screen is not fullscreen, but it is edge-to-edge. (there are other UI elements on the screen, part of our custom UI), and we're using AVQueuePlayer and creating a custom player.


We have some business reasons to disallow PiP on specific videos, so this change is a bit of a curveball for us.


We also didn't experience this behaviour on iOS 12 and lower. If we switch off the Multiasking "Picture In Picture" options in settings, it reverts back to the iOS 12 behaviour (somewhat expected, i suppose).


If I adjust the margins on my AVPlayerLayer to be less than full width, we no longer get PiP on background.



I'm filing a radar with Apple to clarify the behaviour - we have a workaround for the issue, but i'd still like to know if there's a reasonable way to resolve.

@kcatigbe_nbcu have you had any luck with the radar with Apple? We're experiencing the exact same problem.

In general PiP is controlled by AVKit, so you'll likely want to add the AVKit tag to this post.

iPadOS Picture-In-Picture automatically invoking when backgrounding App
 
 
Q