在我们的应用程序中,我们有一个通过 AVKit 的自定义播放器,它支持 iPad 上的画中画多任务处理。
画中画设置后不久,restoreUserInterfaceForPictureInPictureStopWithCompletionHandler
似乎无缘无故地调用了委托(delegate)方法函数。
在 Apple's documentation它说:
This method is called no matter how PiP ends, whether it is because the user ended playback, the user tapped the button to return ongoing video playback to your app, or the video finished playing on its own.
在这种情况下,用户没有结束播放,或者点击按钮返回到应用程序中正在进行的视频,并且视频没有自行完成播放。
为什么画中画可以随机结束的其他原因是什么?
最佳答案
发生这种情况的一种情况是,如果您将 AVAudioSession
设置为类别到环境,这将拆除图片 Controller 中的图片,因此调用 restoreUserInterfaceForPictureInPictureStopWithCompletionHandler
委托(delegate)方法。确保它保留在播放类别中将确保画中画 Controller 不会被删除。
关于ios - iPad画中画随机调用restoreUserInterfaceForPictureInPictureStopWithCompletionHandler,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60423382/