WKWebView object, I am opening a URL using the WKWebView object, and I am conducting audio and video communication on that URL by granting camera and microphone permissions. The issue I'm facing is that every time the URL is opened, the browser asks for permissions repeatedly, which I want to avoid. Is there a way to request permissions only once?
I want the browser opened with WKWebView to ask for camera and microphone permissions only once and not prompt for them again in subsequent uses. When my application opens, I need it to connect directly to the web address and start the video call without permissions.
With iOS >= 15 you can do with code:
@available(iOS 15.0, *)
func webView(
_ webView: WKWebView,
requestMediaCapturePermissionFor
origin: WKSecurityOrigin, initiatedByFrame
frame: WKFrameInfo,
type: WKMediaCaptureType,
decisionHandler: @escaping (WKPermissionDecision) -> Void) {
decisionHandler(.grant)
}