Skip to content

Commit

Permalink
Update ViewController.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
Keillion committed Nov 19, 2024
1 parent ed1dab0 commit 58d6eb1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions hello-world/webview/ios/dbrjswebview/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,15 @@ class ViewController: UIViewController, WKUIDelegate {
present(alertController, animated: true, completion: nil)
}

// Auto grant camera access
// Refer: https://stackoverflow.com/a/72729381/6414094
func webView(_ webView: WKWebView,
requestMediaCapturePermissionFor
origin: WKSecurityOrigin,initiatedByFrame
frame: WKFrameInfo,type: WKMediaCaptureType,
decisionHandler: @escaping (WKPermissionDecision) -> Void){
decisionHandler(.grant)
}

}

0 comments on commit 58d6eb1

Please sign in to comment.