WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
259823
Calling getDisplayMedia() the first time results in an error.
https://bugs.webkit.org/show_bug.cgi?id=259823
Summary
Calling getDisplayMedia() the first time results in an error.
mawojtcz
Reported
2023-08-04 03:59:34 PDT
When we call getDisplayMedia() the user sees the UI to allow screen or window sharing, user chooses screen sharing and then getDisplayMedia() rejects with the error: "The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission." After that, if we call the same API again, it works fine. If the user then closes Safari and starts it again, he/she will get the error again. Here is a simple js fiddle for reproducing the issue:
https://jsfiddle.net/bazyl/zvfuh1n0/
steps: 1. run the js fiddle in Safari 2. press the "start screen share button" 3. you will see the safari UI to allow screen or window sharing, choose screen 4. at this point you should see a "SUCCESS" string beneath the button, but instead you will see "ERROR" and errors in the console 5. pressing the button again works fine - this time you get "SUCCESS" This issue is not 100% reproducible, some users can't reproduce it at all, some others see it very often (about 50% of the time) Also, it usually take a long time for getDisplayMedia() to resolve with the error (up to 1 minute). This has been tested and seen on the following Safari versions on macOS: Version 16.5.1 (18615.2.9.11.7) Version 16.6 (18615.3.12.11.2) Version 17.0 (19616.1.17.11.4) This is affecting the webex web app (from web.webex.com)
Attachments
repeated requests to navigator.mediaDevices.getDisplayMedia always results in error
(400.52 KB, image/png)
2023-10-01 14:49 PDT
,
Michael
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2023-08-04 14:25:39 PDT
<
rdar://problem/113413459
>
Eric Carlson
Comment 2
2023-08-04 14:28:33 PDT
(In reply to mawojtcz from
comment #0
)
> Also, it usually take a long time for getDisplayMedia() to resolve with the > error (up to 1 minute).
WebKit sets a 60 second watchdog timer when the system prompt is shown, so this suggests that ScreenCaptureKit.framework isn't calling WebKit's delegate after the user chooses a screen or window (see
https://github.com/WebKit/WebKit/blob/main/Source/WebCore/platform/mediastream/mac/ScreenCaptureKitSharingSessionManager.mm#L380
). It would be extremely helpful for us to examine a sysdiagnose taken after such a failure. If it is possible to get one, please send it directly to me at
eric.carlson@apple.com
.
Michael
Comment 3
2023-10-01 14:46:11 PDT
In my case I never get a prompt to share the screen and can consistently reproduce this. navigator.mediaDevices.getDisplayMedia({ video: true, audio: true, }) always results in: NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission. Simple fiddle example:
https://jsfiddle.net/9uLcgb0d/
This also does not work for example:
https://www.webrtc-experiment.com/RecordRTC/
I've submitted Feedback + sysdiagnose under: FB13222093 Please let me know if I can help. Version 17.0 (17616.1.27.111.22, 17616)
Michael
Comment 4
2023-10-01 14:49:36 PDT
Created
attachment 468007
[details]
repeated requests to navigator.mediaDevices.getDisplayMedia always results in error
mawojtcz
Comment 5
2023-10-03 03:53:23 PDT
Hello, any update on this, please? We have sent sysdiagnose files over email to Eric as requested on Aug 23rd and also a screen recording with another sysdiagnose on Aug 30th and then resent them again on Sept 19th.
saghul
Comment 6
2023-10-09 06:04:40 PDT
I can reproduce this 100% in macOS Monterrey with Safari 17. Not so on Sonoma.
Jacek Stypuła
Comment 7
2023-12-02 06:32:40 PST
I have the same problem as Michael all the time, see
https://bugs.webkit.org/show_bug.cgi?id=259823#c3
and
https://bug-259823-attachments.webkit.org/attachment.cgi?id=468007
. Screen capturing does not work in any web app. My system version is macOS 12.7.1 (21G920). My Safari version is 17.1.2 (17616.2.9.11.12, 17616).
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug