I've noticed that when you ask WKWebView to enumerate devices by navigator.mediaDevices.enumerateDevices, it returns undefined when permissions are not granted. As the WKWebView doesn't ask for permission to camera itself, I've added a function to send message to WebView, and when controller receives it, it asks user for camera permission by AVCaptureDevice.requestAccess(for: .video). When user grant permission, the WKWebView still has the navigator.mediaDevices undefined as long as user won't restart the app. Shouldn't the API be available as soon as user grant permission?
<rdar://problem/79286449>
Created attachment 431323 [details] Patch
Committed r278841 (238789@main): <https://commits.webkit.org/238789@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 431323 [details].