RESOLVED FIXED289529
enumerateDevices returns devices as available when permissions are denied
https://bugs.webkit.org/show_bug.cgi?id=289529
Summary enumerateDevices returns devices as available when permissions are denied
Maria Ivanova
Reported 2025-03-11 07:44:54 PDT
Repro steps: 1. Open browser and go to https://webrtc.github.io/samples/src/content/devices/input-output/ 2. In settings check that permissions are granted for both camera and mic 3. Go to settings (safari -> settings for ... or safari ->settings -> websites -> camera) and deny access to camera only 4. Refresh the page Actual result: Video source select will have all videoinput sources as before. If call await navigator.mediaDevices.enumerateDevices() in the console, devices with kind 'videoinput' will have label, deviceId and groupId. Expected result: When permission for camera is revoked, calling await navigator.mediaDevices.enumerateDevices() should return devices with kind 'videoinput' with empty label, deviceId and groupId. Additional information: If both camera and microphone permissions are denied, navigator.mediaDevices.enumerateDevices() returns devices with empty label, deviceId and groupId as expected. But if deny only one (camera or microphone) the result will be as if both permissions are granted
Attachments
Radar WebKit Bug Importer
Comment 1 2025-03-18 07:45:23 PDT
youenn fablet
Comment 2 2025-03-27 03:57:30 PDT
EWS
Comment 3 2025-03-31 00:09:42 PDT
Committed 292921@main (75d48825d90d): <https://commits.webkit.org/292921@main> Reviewed commits have been landed. Closing PR #43103 and removing active labels.
Maria Ivanova
Comment 4 2025-05-16 02:34:08 PDT
Tested with Safari Technology Preview Release 219 (Safari 18.4, WebKit 20622.1.12) Now if I try repro steps and revoke permissions for camera, navigator.mediaDevices.enumerateDevices() correctly returns devices with kind 'videoinput' with empty label, deviceId and groupId. But devices with kind 'audioinput' which stays allowed also returned with empty label, deviceId and groupId. Expected result: navigator.mediaDevices.enumerateDevices() should return devices with label, deviceId and groupId when permission is granted and return empty label, deviceId and groupId when it is not.
youenn fablet
Comment 5 2025-05-16 03:11:18 PDT
@Maria, testing with https://codepen.io/youennf/pen/MYYxGwq, it seems to work fine. In particular, if camera permission is denied, microphone permission is granted, I have the following results: - getUserMedia not called: enumerateDevices expose devices without labels. - getUserMedia called for microphone: enumerateDevices expose microphone devices with labels (camera devices remain without labels). Can you clarify what is unexpected (or repro steps?).
Maria Ivanova
Comment 6 2025-06-20 03:19:24 PDT
I created new codepen just with navigator.mediaDevices.enumerateDevices() api https://codepen.io/mashka/pen/VYLEzrL in case when both camera and mic is allowed (permissions are granted), enumerateDevices returns audio and video devices with labels in case when settings set to "deny" or "ask" for both camera and mic enumerateDevices returns audio and video devices with empty labels. but if only one permission is granted (camera or microphone) enumerateDevices still returns list with labels for both audio and video devices. Expected result is to see devices with labels only for permission that was granted. was testing in Safari Version 18.5 (20621.2.5.11.8)
Note You need to log in before you can comment on or make changes to this bug.