Open schloram opened 2 years ago
This seems to be missing in the compiled app:
electron_1.systemPreferences.askForMediaAccess('microphone')
electron_1.systemPreferences.askForMediaAccess('camera')
maybe add command line arguments to enable these requests (just as it happens with the enableEs3Apis
, ignoreCertificate
etc.)
However it is also missing the request to do screen access (screen sharing) and I couldn't fix that so easily
This bug still persists with Nativefier 46.0.0
Same issue with Nativefier 46.0.4
I made workaround for that problem. Unfortunately it doesn't work with screen sharing.
Now you can change the application icon by right-clicking on the automator application, selecting "About" and dragging the icon to the icon in the upper left corner.
When you run this app it should can prompt for media access.
I hope I helped.
@lucek8123 Isn't your workaround missing some code? You mention a shell script but did not provide any code to add to it.
I'm having a similar problem, but let me know if you would prefer that I open a separate issue.
@schloram I think I'm trying to package the same webapp (internal 3CX endpoint), but I'm having the issue you're having on macOS Big Sur. I'm not getting prompt for any permissions and the microphone is not working. When moving the same nativefier .app
on a macOS Catalina machine, I do get prompt for the microphone and camera permissions (macOS system popups).
I also tried using another URL following @ronjouch test case (https://github.com/nativefier/nativefier/issues/1246#issuecomment-869591822) with the following command and I'm getting the exact same results (only getting prompt for microphone permission on macOS Catalina):
nativefier "https://webaudiodemos.appspot.com/AudioRecorder/index.html"
It's hard to tell if this is a nativefier issue or a electron issue. I found two electron issues about the same topic, but they are not describing exactly the issue we're having: https://github.com/electron/electron/issues/31875 https://github.com/electron/electron/issues/29861
Build environment:
Where it works: macOS Catalina (10.15.7)
Where it doesn't work: macOS Big Sur (11.6.3)
@lucek8123 Isn't your workaround missing some code? You mention a shell script but did not provide any code to add to it.
I said:
Drag and drop file that is in previously opened folder to text field in action editor
So you should drag and drop file from finder to automator shell script text field. That should make path to executable file on text field. (you can watch it here)
Only one thing that I didn't say is that you should build your nativefire app with tag --fast-quit because when you open the automator app and when you close it the automator app still running.
My workaround works because it running nativefire app on another, automatomator app that can prompt for media access. That app make the same as opening app from terminal. Terminal can prompt access for camera, microphone, and screen sharing(I tested it with OBS Studio) so that automator script use that. Only screen sharing is unsupported. I think the nativefire apps haven't support for it, because when i tested OBS Studio it support it.
@lucek8123 Ok, wow, that does not make any sens to me, but it does work. Thanks for the video by the way. I just launch the app through my terminal (see below) and I got the permission prompts. But of course, it grants the permissions to the Terminal app, not the nativefier app, so I see why you made an automator app as a "shortcut" to launch the real app.
I did find this answer describing this fix. I didn't have to run the tccutil reset Microphone
, only invoke my nativefier app through the terminal.
@schloram Could you try doing this to see if it does prompt for permissions? Open the terminal and run the following command (replace both APPNAME
by you application name), assuming your app is installed in the Applications directory:
/Applications/APPNAME.app/Contents/MacOS/APPNAME
Regardless though, I do not know what does that mean for the source of the issue. The fact that it works in the terminal mean that the permission are actually requested properly by the app. But the fact that it does not work by itself is strange. Maybe it means that another layer of macOS security is interfering, like the fact that the nativefier apps are not signed? If that was the case, it's probably an electron issue, not nativefier issue.
Hey, I have actually found a way to manually add the Microphone permission for the nativefier app! 🎉 But unfortunately, the way to do it is not nice. 😕
Walktrough:
brew install tccutil
(https://github.com/jacobsalmela/tccutil)$(brew --prefix)/bin/tccutil
in a text editor (located at /usr/local/bin/tccutil
on Intel mac)tcc_db
(line 32) like this and make sure to replace USERNAME
by your macOS username:
tcc_db = '/Users/USERNAME/Library/Application Support/com.apple.TCC/TCC.db'
APPNAME
by you application name:
defaults read /Applications/APPNAME.app/Contents/Info CFBundleIdentifier
BUNDLEID
by the output of the previous command:
sudo $(brew --prefix)/bin/tccutil --service kTCCServiceMicrophone --insert "BUNDLEID"
kTCCServiceMicrophone
by kTCCServiceCamera
@pgrenaud @lucek8123 Thanks for your input. I appreciate it. But since your solutions are more like hacks I'm hesitant to apply them. I don't want to "bend" my OS to force a behavior the nativefier app should handle out of the box.
To be honest I suspect the bug inside nativefier because I don't have any problems with any native electron app (e.g Jitsi) to access my microphone/camera.
As long as this is not fixed I will use the app in my browser.
@pgrenaud Just a heads up: Seems like 3CX has just released a working Mac OS app now (the last one was crap hence my nativefier approach). So actually no need to use nativefier anymore for 3CX. Just wanted to let you know. :)
@schloram Ha ha! I never said that that my workaround was a viable solution. It is definitely a very hacky workaround. In the end, it's just another demonstration that something is wrong with nativefier with the asking permission process, but that the permissions themselves work fine. There is definitely something that needs to be fixed.
And thanks for the heads up about the macOS app! I just got the update on our system. But I have to say that I am quite disappointed with the totally useless menu bar icon, that is also awfully ugly (it does not respect the macOS design guidelines at all). It is a step in the right direction, but I would hope that they remove that (which probably won't happen anyway).
Hey, I have actually found a way to manually add the Microphone permission for the nativefier app! 🎉 But unfortunately, the way to do it is not nice. 😕
On which version of macOS could you make this work? On Monterey I'm getting
sqlite3.OperationalError: unable to open database file
Checking the tccutil code the problem seems to be that this file actually isn't existing in '/Users/
if not os.path.isfile(tcc_db):
print("TCC Database has not been found.")
sys.exit(1)
conn = sqlite3.connect(tcc_db)
c = conn.cursor()
Did you manually create the file?
Some googleing around I found this presentation (slide 7) where it's explained that Apple removed this possibility due to a hack from Dropbox. https://objectivebythesea.com/v4/talks/OBTS_v4_aGrant.pdf
Any updates on this issue?
This seems to be fixed for me in 50.0.1. I can just launch the nativefied app, and it will properly ask for permissions (in this case for Google Meet). NOTE: I am using --user-agent-honest
.
@lucek8123 is there a way that you could take a look at my case? I followed the steps you provided, yet my app doesn't launch. I end up with an error that says that directory doesn't exists :/
@lucek8123 is there a way that you could take a look at my case? I followed the steps you provided, yet my app doesn't launch. I end up with an error that says that directory doesn't exists :/
I see why this error is. You didn’t provided full pathname. Just instead of of drag and drop, right click on file while holding option key and select option “copy … as pathname”. Then paste it into editor in automator. Example commands in automator: “/Users/Lucek/Desktop/ChatGPT.app/Contents/MacOS/ChatGPT”, “/Applications/Chess.com.app/Contents/MacOS/Chess.com”.
@lucek8123 Thanks! I was able to create and run shell script app.
It didn't prompt for camera and microphone access thou, so I'm still stuck :(
Homework
nativefier --help
and https://github.com/nativefier/nativefier/blob/master/API.mdBug description
The created Nativefier app does not ask for media access on Mac OSX Monterey when trying to access them. This was possible before with Big Sur.
Steps to reproduce
Verbose output (NOTE: I had to change some values because this is for a internal VOIP Client):
Expected behavior
Actual behavior
I tested this on 4 different Macs. Two with Big Sur and two with Monterey. The Big Sur Macs work perfectly and have the excpected behavior listed above.
The other two Monterey Macs do not prompt anything at all. I also tried to reset the Microphone permissions on my mac with
tccutil reset Microphone
. I also deleted the whole~/Library/Application Support/com.apple.TCC
directory and restarted. Nothing helped.This happens with every Nativefier created app but does not happen with native apps (like Goggle Chrome) or other Electron based Apps (like Jitsi Meet).
Context