Hello i am trying to make use of the new WKWebView additions so my App doesnt need to reprompt for webRTC webView
camera permission every time i ran my app. →
https://developer.apple.com/documentation/webkit/wkuidelegate/3763087-webview#discussion
I created a custom view controller like described here (Capacitor - build cross platform apps with the web) but i am failing to implement the new WKWebView additions to my custom view controller.
The following give me an error of Value of tuple type '()' has no member 'deny'
import UIKit
import Capacitor
@available(iOS 15.0, *)
class ViewController: CAPBridgeViewController, WKUIDelegate {
override func viewDidLoad() {
super.viewDidLoad()
webView?.uiDelegate = self
// Do any additional setup after loading the view.
}
@available(iOS 15.0, *)
func webView(_ webView: WKWebView,
requestMediaCapturePermissionFor origin: WKSecurityOrigin,
initiatedByFrame frame: WKFrameInfo,
type: WKMediaCaptureType,
decisionHandler: @escaping (WKPermissionDecision) -> Void) {
return type == .camera ? .prompt : .deny
}
}
i also tried it like this
import UIKit
import Capacitor
@available(iOS 15.0.0, *)
class ViewController: CAPBridgeViewController, WKUIDelegate {
override func viewDidLoad() {
super.viewDidLoad()
webView?.uiDelegate = self
// Do any additional setup after loading the view.
}
@available(iOS 15.0.0, *)
func webView(_ webView: WKWebView,
requestMediaCapturePermissionFor origin: WKSecurityOrigin,
initiatedByFrame frame: WKFrameInfo,
type: WKMediaCaptureType,
decisionHandler: @escaping (WKPermissionDecision) -> Void) {
return type == .camera ? .prompt : .deny
}
}
but no luck so far.
I am now always getting a AbortError
on camera access - no permission prompt at all.
What am i doing wrong?