gpt4 book ai didi

ios - WKWebView 不允许在应用程序中访问相机

转载 作者:行者123 更新时间:2023-11-29 05:40:03 25 4
gpt4 key购买 nike

我们正在尝试与多个用户进行电话 session ,因此通过使用 Kurento 服务器,我们已经实现了这一目标,并且它可以在 safari 浏览器上运行。但是当涉及到 WebView/WKWebView 中的实现时。它甚至不请求权限。

@IBOutlet weak var webViewContainer: UIView!
var webView: WKWebView!

override open func loadView() {
super.loadView()

let webConfiguration = WKWebViewConfiguration()
webConfiguration.ignoresViewportScaleLimits = true
webConfiguration.suppressesIncrementalRendering = true
webConfiguration.allowsInlineMediaPlayback = true
webConfiguration.allowsAirPlayForMediaPlayback = false
webConfiguration.allowsPictureInPictureMediaPlayback = true
webConfiguration.mediaTypesRequiringUserActionForPlayback = .all
webConfiguration.requiresUserActionForMediaPlayback = true
webView = WKWebView(frame: webViewContainer.frame, configuration: webConfiguration)
webView.uiDelegate = self
webView.navigationDelegate = self
webView.sizeToFit()
webView.backgroundColor = .black
webView.isOpaque = false
self.webViewContainer.addSubview(webView)

}

func webContentController()-> WKUserContentController {
let contentController = WKUserContentController()
let script = try! String(contentsOf: Bundle.main.url(forResource: "WebRTC", withExtension: "js")!, encoding: String.Encoding.utf8)
contentController.addUserScript(WKUserScript(source: script, injectionTime: WKUserScriptInjectionTime.atDocumentStart, forMainFrameOnly: true))
contentController.add(self, name: "callbackHandler")
return contentController
}

override func viewDidLoad() {
super.viewDidLoad()
guard let url = URL (string: urlStr) else { return
}
let myRequest = URLRequest(url: url)
self.webView.load(myRequest)
}

我什至在safariViewController中尝试过此链接,但它不要求相机权限。

最佳答案

This

您是否按照文档中的步骤操作?最重要的部分是 NSCameraUsageDescription/NSMicrophoneUsageDescription 必须存在于 info.plist 文件

关于ios - WKWebView 不允许在应用程序中访问相机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56646575/

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