Skip to content

Commit cd391f7

Browse files
authored
Update ViewController.swift (#223)
1 parent ed1dab0 commit cd391f7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

hello-world/webview/ios/dbrjswebview/ViewController.swift

+10
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,15 @@ class ViewController: UIViewController, WKUIDelegate {
102102
present(alertController, animated: true, completion: nil)
103103
}
104104

105+
// Auto grant camera access
106+
// Refer: https://stackoverflow.com/a/72729381/6414094
107+
func webView(_ webView: WKWebView,
108+
requestMediaCapturePermissionFor
109+
origin: WKSecurityOrigin,initiatedByFrame
110+
frame: WKFrameInfo,type: WKMediaCaptureType,
111+
decisionHandler: @escaping (WKPermissionDecision) -> Void){
112+
decisionHandler(.grant)
113+
}
114+
105115
}
106116

0 commit comments

Comments
 (0)