gpt4 book ai didi

ios - 访问 WKWebView 的 AVPictureInPictureController 的委托(delegate)回调

转载 作者:行者123 更新时间:2023-11-28 06:10:54 24 4
gpt4 key购买 nike

我需要能够访问 WKWebView 的原生 AVPictureInPictureController 的委托(delegate)回调方法 pictureInPictureControllerDidStopPictureInPicture(_:)AVPictureInPictureController 没有像旧的 MPMoviePlayerViewController 那样的全局通知事件,我无法创建自己的 AVPictureInPictureController 实例来与Web View 以访问委托(delegate)回调。我找不到关于如何连接到 WKWebView 对象的这个内部 AVPictureInPictureController 的文档。我希望至少有一些方法可以用 KVO 做到这一点。

https://developer.apple.com/library/content/documentation/WindowsViews/Conceptual/AdoptingMultitaskingOniPad/QuickStartForPictureInPicture.html

The WebKit framework provides the WKWebView class, which supports Picture in Picture in iOS 9.

https://developer.apple.com/documentation/avkit/avpictureinpicturecontrollerdelegate/1614717-pictureinpicturecontrollerdidsto

最佳答案

如果您有权访问您的AVPictureInPictureController,您可以简单地设置它的委托(delegate)并实现回调

class MyWebView: WKWebView {

self.myPictureInPictureController.delegate = self

}

extension MyWebView: AVPictureInPictureControllerDelegate {
func pictureInPictureControllerDidStopPictureInPicture(_ pictureInPictureController: AVPictureInPictureController) {
//code
}
}

关于ios - 访问 WKWebView 的 AVPictureInPictureController 的委托(delegate)回调,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46649430/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com