I am working on video player application and want to add Picture in Picture feature. I added this feature(using AVPictureInPictureController) and it works perfect, except one issue. After I click PiP button, PiP activated but application do not go to the home screen (picture attached). I need to push Home button. Ho to hide app and show home screen after PiP button tapped?
Starting iOS 14.2, Apple has provided this API to start PIP without user intervention.
You can do it this way without getting your App rejected:
if #available(iOS 14.2, *) {
pictureInPictureController.canStartPictureInPictureAutomaticallyFromInline = true
}
Not sure if this helps, but if you do this:
func applicationDidEnterBackground(application: UIApplication) {
pictureInPictureController.startPictureInPicture()
}
Then when a user presses the home button or switches apps, the video will go PIP. It's how NetFlix works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With