ios - iPad画中画随机调用restoreUserInterfaceForPictureInPictureStopWithCompletionHandler

标签 ios ipad picture-in-picture

在我们的应用程序中,我们有一个通过 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/

相关文章:

ios - 尝试在 tableView :editActionsForRowAt: 中设置带有图像的按钮

ios - 如何将数据传递给从 UIStoryboard 实例化的 View Controller ?

iphone - iOS - 知道模态视图何时被关闭

objective-c - 在 iOS 应用程序中设置配置文件的最佳方法

iphone - 如何在 iPhone 中创建网格日历?

java - 如何解决实现画中画功能时的宽高比问题?

ios - 退化的顶点和 GL_LINE_STRIP

ios - 应用程序是通用的,但 Assets 管理器中的 AppIcon 没有 iPad 图标的空间

ios - 向上滑动(将应用程序置于后台)并且视频正在自定义 AVPLayer 中播放时,如何停止画中画?

javascript - 画中画和全屏一起 - API 只能通过用户手势启动