Bug 289529
| Summary: | enumerateDevices returns devices as available when permissions are denied | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Maria Ivanova <mariaivanova> |
| Component: | WebRTC | Assignee: | youenn fablet <youennf> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | jer.noble, webkit-bug-importer, youennf |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari 18 | ||
| Hardware: | Mac (Intel) | ||
| OS: | macOS 15 | ||
Maria Ivanova
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 | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/147313922>
youenn fablet
Pull request: https://github.com/WebKit/WebKit/pull/43103
EWS
Committed 292921@main (75d48825d90d): <https://commits.webkit.org/292921@main>
Reviewed commits have been landed. Closing PR #43103 and removing active labels.
Maria Ivanova
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
@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
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)