[Webkit-unassigned] [Bug 208667] getUserMedia does not work in WKWebView-based browsers like Chrome, Firefox.
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Dec 9 03:02:17 PST 2020
https://bugs.webkit.org/show_bug.cgi?id=208667
--- Comment #69 from support at buildagil.ch ---
Comment on attachment 415730
--> https://bugs.webkit.org/attachment.cgi?id=415730
Confirm that getUserMedia() works with iOS 14 Beta 2 and Beta 3 using a WKWebView
Unfortunately there is another annoying issue with "the emerging life" of getUserMedia().
When executing getUserMedia() two similar prompts for user permission appear for:
a) using the camera and (getUserMedia({ video: true }))
b) using the microphone (getUserMedia({ audio: true }))
Since this makes absolutely no sense for an enduser I consider this a bug.
I attached the HTML and screenshots that show the problem.
I use webView in Swift 5 as follows:
```
class ViewController: UIViewController, WKNavigationDelegate, UIScrollViewDelegate, WKUIDelegate {
@IBOutlet var webView: WKWebView!
override func loadView() {
super.loadView()
let config = WKWebViewConfiguration()
config.allowsInlineMediaPlayback = true
webView = WKWebView(frame: .zero , configuration: config)
webView.navigationDelegate = self
webView.uiDelegate = self
webView.scrollView.delegate = self
view = webView
}
override func viewDidLoad() {
super.viewDidLoad()
url = URL(string: "https://app.buildagil.ch/assets/www/camera.html")!
}
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
guard #available(iOS 14.2, *) else {
webView.evaluateJavaScript("delete navigator.__proto__.mediaDevices")
return
}
}
}
```
Note: this behaviour is basically the same as we already know from the navigator.geolocation.getCurrentPosition() API. This problem can be solved by following the solution described here: https://stackoverflow.com/questions/39665367/how-to-prevent-wkwebview-to-repeatedly-ask-for-permission-to-access-location
There seems to be the same underlying problem causing this behavior with WKWebView. As it seems there is a problem with managing/mapping the permissions granted to the app (1st prompt) itself and the embedded webView (2nd prompt).
I also opsted a question here: https://developer.apple.com/forums/thread/669011
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20201209/e81f8fa3/attachment.htm>
More information about the webkit-unassigned
mailing list