Bug 226969

Summary: Accessing navigator.mediaDevices.enumerateDevices after granting permission
Product: WebKit Reporter: jakubesuszynski
Component: WebRTCAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: eric.carlson, ews-watchlist, glenn, jer.noble, philipj, sergio, sihui_liu, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: iPhone / iPad   
OS: iOS 14   
Attachments:
Description Flags
Patch none

Description jakubesuszynski 2021-06-14 07:01:21 PDT
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?
Comment 1 Radar WebKit Bug Importer 2021-06-14 07:06:17 PDT
<rdar://problem/79286449>
Comment 2 youenn fablet 2021-06-14 07:25:21 PDT
Created attachment 431323 [details]
Patch
Comment 3 EWS 2021-06-14 11:39:09 PDT
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].