[Webkit-unassigned] [Bug 271688] New: getDisplayMedia is not showing sharing picker after delegating requestMediaCapturePermissionFor

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Mar 25 21:17:50 PDT 2024


https://bugs.webkit.org/show_bug.cgi?id=271688

            Bug ID: 271688
           Summary: getDisplayMedia is not showing sharing picker after
                    delegating requestMediaCapturePermissionFor
           Product: WebKit
           Version: Other
          Hardware: Mac (Apple Silicon)
                OS: macOS 14
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebRTC
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: jason at pews.dev
                CC: youennf at gmail.com

- Scenario

We delegated [webView:requestMediaCapturePermissionForOrigin:initiatedByFrame:type:decisionHandler:] only and called navigator.mediaDevices.getDisplayMedia() on JavaScript. It will not show the ScreenCapture picker (SCContentSharingPicker) and deny the request.

* Reproducible example: https://gist.github.com/pewsheen/9685c2a3a77c1303d5026b7a8dd9e893
* Test page: https://webrtc.github.io/samples/src/content/getusermedia/getdisplaymedia/
* Console:

default 11:48:25.720336+0800    aa      UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame(AD3DE9E20BF5B109) 116
default 11:48:25.720458+0800    aa      UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest(AD3DE9E20BF5B109) 116, persistent access: false
default 11:48:25.720537+0800    aa      UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest(AD3DE9E20BF5B109) 116, video: 0 audio: 0
default 11:48:25.720561+0800    aa      UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest(AD3DE9E20BF5B109) 116, action: Prompt
default 11:48:25.720608+0800    aa      UserMediaPermissionRequestManagerProxy::denyRequest(AD3DE9E20BF5B109) 116, reason: PermissionDenied

- Expected behavior

Even if we delegated requestMediaCapturePermissionForOrigin, it should show SCContentSharingPicker when calling getDisplayMedia().


The following is my guess...

The condition here: https://github.com/WebKit/WebKit/blob/a0b7f7faeffb5ec679ddd471a0f7c68a91a37715/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm#L1273 shows that if any one of request methods delegated, then it will not perform the default action for all the request methods.

When we delegate requestMediaCapturePermissionForOrigin and call getDisplayMedia(), it will go to the line: https://github.com/WebKit/WebKit/blob/a0b7f7faeffb5ec679ddd471a0f7c68a91a37715/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm#L1281 to prompt for display capture permission, and somehow https://github.com/WebKit/WebKit/blob/a0b7f7faeffb5ec679ddd471a0f7c68a91a37715/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm#L1212 canRequestDisplayCapturePermission returns false? So that if we didn't delegate [_webView:requestDisplayCapturePermissionForOrigin:initiatedByFrame:withSystemAudio:decisionHandler:] as well, it will deny the request https://github.com/WebKit/WebKit/blob/a0b7f7faeffb5ec679ddd471a0f7c68a91a37715/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm#L1218-L1221

Also, requestDisplayCapturePermissionForOrigin isn't listed on the developer document. Is is a private API?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240326/b48d8557/attachment.htm>


More information about the webkit-unassigned mailing list