-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getDisplayMedia() has permission issue #2600
Comments
Side effect of #2317? |
I am experiencing the same error. NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission. and on the server I get: +++ 0x60000040ee60 0 1 914797062695125 My plist is: <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
<key>com.apple.security.automation.apple-events</key>
<true/>
<key>com.apple.security.device.usb</key>
<true/>
<key>com.apple.security.device.camera</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.inherit</key>
<true/>
</dict>
</plist> and the request is: return await navigator.mediaDevices.getDisplayMedia({
audio: false,
video: {
//@ts-ignore
mandatory: {
displaySurface: 'monitor', // tried 'desktop', 'screen', 'display'
chromeMediaSourceId: 1,
minWidth: 1280,
maxWidth: 1680,
minHeight: 720,
maxHeight: 1050
}
}
}).then(stream => console.log(stream))
.catch(e => console.log(e)) Also |
Can someone please help with this problem for Webkit on MacOS? |
@cliqer, I'm not an expert, so not sure if what I'm going to say would make any sense, but AFAIK there is no such thing as It seems like this is very specific to the Chromium engine and Electron even implemented an extension/helper to handle the I'm not sure these could work with |
@application-developer-DA you are totally right. WKWebView does not support There are a few solutions that could be a workaround but need implementation:
This is a mandatory feature of our application as we need webrtc screen sharing and the only problem we have as to port it to Tauri/rust from electron is the luck of capturing the video stream of the screen. Any good soul out there with the knowledge to port electron's implementation of Any recommendations would be very much appreciated. |
Yeah, right. We're in the same boat.
I think the only "viable" (not really unfortunately) option would be using I think basically you're left with 2 options here:
|
I'm not a tauri user but i came across the same problem and found this post. After quite some digging i was able to get a acceptable solution for my WKWebView based project.. a) ensure to request screen capture permissions for the app itself via CGPreflightScreenCaptureAccess() / CGRequestScreenCaptureAccess() b) it's necessary to implement a private delegate. I found this here: SafeExamBrowser/seb-mac#150 Try this minimal example that i derived from my own project:
With this i was able to get a media stream. Although the chooser is still missing. It shares the screen with the browser view on it. Maybe the situation improves with a later webkit version. Seems they work on it: WebKit/WebKit#9789 Hope this helps you! |
i got same error on ubuntu 22.04. i am sure my code works well in browsers. |
This issue is about macOS. On Linux, even though it's the same error message, the cause is different == webrtc just isn't a thing in webkitgtk yet (to be exact, it is being worked on but hidden behind a build flag only distro maintainers can flip) |
Has anyone managed to get this working? Just calling getDisplayMedia leads to the same errors @cliqer was having in 2022. |
@stolinski, this has been fixed in Webkit v16.1 on Ventura. |
@stolinski try the following if you haven't. Hope it helps:
in your tauri.conf.json: {
{
"tauri": {
"macOSPrivateApi": true,
"bundle": {
"active": true,
"macOS": {
"entitlements": "Release.entitlements",
"exceptionDomain": "",
"frameworks": [],
},
"resources": [],
"targets": ["app"],
}
},
"security": {
"csp": null
}
}
} |
Thanks for the help @cliqer but sadly no dice. Still hitting the same permissions error. |
So I can confirm that getDisplayMedia has been added to WKWebView it does not work within Tauri still because there is no permission dialog and therefore the request for getDisplayMedia will always return a permission denied error. So this seems to be an issue with Tauri as is right now as you are unable to grant permissions to use getDisplayMedia. |
@stolinski it works for me and dialogue is being displayed in the latest Tauri v1 and Ventura 13.5.1 (22G90): return await navigator.mediaDevices.getDisplayMedia({
audio: false,
video: true
}) |
Is this in development? How frustrating. I'm on Sonoma, latest Tauri v1 and just getting the permissions failed instantly with the same getDisplayMedia code to request. Do you know of a way to reset permissions completely on a Tauri app? I've tried building for production and got the same permission failure immediately. |
Just fired up a totally fresh Tauri app, requested
And got hit with the same permission denied error without a dialogue. Now wondering if this is a Sonoma related issue. (on 14.0 Beta (23A5337a)) |
Small update on this. I can confirm that the permissions prompt is being issued on MacOS v13 but not on v14, which is still unreleased although in rc. I'll update again once the OS is official.
|
I'm on tauri v2 and MacOS 13.5.1. Sometime the |
Upgraded to Sonoma v14 and previous implementation doesn't work anymore. |
Same in the linux (Arch)! getUserMedia error: webkit2gtk version is 2.42.1-1 Is there any thought when this will be fixed? |
No idea when this will be fixed, the webkitgtk didn't gave any ETAs or hints but they are actively working on it. Oh and to be clear, Linux does not have webrtc support yet so there isn't any "bug" preventing it, it's just not there yet. |
@cliqer I am not sure that is the case, I just launched a simple WebView from xcode with a target of Sonoma 14.0 and did a simple |
Was able to identify and fix the issue here tauri-apps/wry#1107, thanks to @pewsheen recognising where the bug resided! |
awesome, thanks! Can this issue be closed now? |
If someone using the latest tauri version and macos 14 can confirm that this pr helped, yes :) |
I checked on the latest v2.alpha with Sonoma, and it works. |
@cliqer I think the latest tauri v1 doesn't have the latest wry package, it was only released in wry v0.35.1, What I have done in my release pipeline is use my own "local" version of tauri with a changed Cargo.toml for wry runtime pointing to 0.35.1 |
Cool, thanks for confirming. Backporting it to wry 0.24 (the version tauri v1 uses) should be fairly straightforward. |
@FabianLars not possible in 1.5.4 yet correct ? |
correct |
Any work scheduled to backport ? |
no, we're focused on getting v2 to beta right now. if someone opens a pr we can take a look though. |
Thanks, in general this is working for me with V2 and the Info.plist. But with
Tauri: [
{"deviceId":"5FF5BAB0009113ACC1477BDA0A1EA60FF64D5CC7","kind":"audioinput","label":"MacBook Pro Microphone","groupId":"19306579CF9380E2372D7691ACE283DC31F4AE7B"},
{"deviceId":"97062E9CE4E98A8320BB77F306345F12C07B5A53","kind":"audioinput","label":"Noah’s iPhone Microphone","groupId":"658F702E23F4D59C4D4CFE26C601542AFBFC64BA"},
{"deviceId":"C8645C00DC77A82269219035D29208FC86D836DD","kind":"videoinput","label":"FaceTime HD Camera","groupId":""},
{"deviceId":"2E8657E4F1B108EF7CFD060F2BF66A340E221F7D","kind":"videoinput","label":"OBS Virtual Camera","groupId":""},
{"deviceId":"084BE7A852816C49220C06FA8DF0ED0265EEB29F","kind":"videoinput","label":"Noah’s iPhone Camera","groupId":""},
{"deviceId":"2D227FB9C6D1138E1769DFE648589478ADCDEF4B","kind":"videoinput","label":"Noah’s iPhone Desk View Camera","groupId":""}
] Safari Desktop: [
{"deviceId":"52ABD94C026B20C3FF3AF37F701E156A1BE7557A","kind":"audioinput","label":"MacBook Pro Microphone","groupId":"082C98394E90C47939E93C4A521FF1E982B9C215"},
{"deviceId":"3CD54FEBE4DEFCBE248BFD371AD7D1CEED8D417E","kind":"audioinput","label":"BlackHole 16ch","groupId":"F71A04BCA6C2953330B04D6A356896A85DC10F8B"},
{"deviceId":"279BC0FB9937E89F18F1A04DFA531855FFE2F8DF","kind":"audioinput","label":"XONE 96 USB 1","groupId":"9A76BF4CBE512A38ABC52BA057DDFA3A8B6AA31A"},
{"deviceId":"F5AEE340A817CCE0D3687ECAE87B0572CD2004B5","kind":"audioinput","label":"Noah’s iPhone Microphone","groupId":"AA5084E4581D1676318EB719F7C8A57951D19576"},
{"deviceId":"99C9D3E03D55E4E77505F6F1262951F7EC63D8AF","kind":"videoinput","label":"FaceTime HD Camera","groupId":""},
{"deviceId":"8A5CF3B9CA0470C0F011F520A3E95B25A8A3A5DE","kind":"videoinput","label":"OBS Virtual Camera","groupId":""},
{"deviceId":"0D5F60A9F4499ABE928B9F7FE9AEE1639B8A5AB1","kind":"videoinput","label":"Noah’s iPhone Camera","groupId":""},
{"deviceId":"8D37863FA87C4452BBC4477D8839B217FD106677","kind":"videoinput","label":"Noah’s iPhone Desk View Camera","groupId":""}
] The two devices missing are I'll keep digging into if its possible to get access to these devices in Tauri / wry, or Swift / WKWebview, but asking here in case anyone else knows. |
Did you get this working somehow? |
I just edited above, calling |
I am unable to get this working still in dev mode via After updating everything, I am now able to successfully get the prompt on fully built apps. Is this a limitation that I'll have to work around or should getDisplayMedia permissions prompt correctly in dev. In dev I see the same NotAllowedError.
Happens even in a brand new project. I'd be interested in seeing what's different in a working example on your end from what's going on with me. |
Hey, won't this PR break all mac versions between 14.0 to 14.2? we should probably still have that check in but just for versions between these so that the notification does not get suppressed |
It's kind of tricky when running |
Yes, it will break those versions. We can do a version check for it, but we don't know the actual affected version yet. What we know is 14.0 is affected, and doesn't know which exact version that Apple changed the behavior back. It would take time to test it. |
That tracks. Is there anyway to get those perms accepted on initialization or is using getDisplayMedia in |
It would be better to test it rather than knowingly release a Tauri version that would break on some MacOS versions imo 😅 |
I don't know how it really works under the ground, but from my experience, I can use |
Did you just add it via the MacOS Perms in system prefs? I've given term and vscode screen recording perms but still no go in dev mode. |
It turns out they are two different issues tauri-apps/wry#1195 It may work with |
Should this work for all the desktop OS? I read all the issues here are with Mac... I'm trying on Linux with Tauri v2, but I cannot get the permission dialog to appear... |
@ktecho Linux (webkitgtk) does not support webrtc at all yet. So we're not just talking about permissions issues there. |
So there is no way to scan a QR code with Tauri on Linux? |
Not in the frontend at least. There should be some camera Rust crates that should support Linux. |
what about windows and linux ?? |
Describe the bug
Hi I try to call getDisplayMedia() but got permission issue, see details below, thanks!
To Reproduce
Steps to reproduce the behavior:
yarn && yarn start
, this start the react dev serveryarn tauri dev
Expected behavior
It should call the getDisplayMedia() successfully without error.
Screenshots
Platform and Versions (required):
Additional context
I already add the Info.plist under src-tauri with the following configuration
The getUserMedia() works properly, but getDisplayMedia() didn't. I try to run the same react app inside safari and the getDisplayMedia() works properly in it.
Stack Trace
The text was updated successfully, but these errors were encountered: