Bug 226969 - Accessing navigator.mediaDevices.enumerateDevices after granting permission
Summary: Accessing navigator.mediaDevices.enumerateDevices after granting permission
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: Other
Hardware: iPhone / iPad iOS 14
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-06-14 07:01 PDT by jakubesuszynski
Modified: 2021-06-14 11:39 PDT (History)
9 users (show)

See Also:


Attachments
Patch (1.74 KB, patch)
2021-06-14 07:25 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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].