Closed tresf closed 2 years ago
Some general questions:
- Are entitlements required for Microphone access to work?
This Unity thread suggests they may be needed:
Quoting:
We discovered that in addition to ensuring
NSMicrophoneUsageDescription
was in the plist in the mac app bundle package Contents when built, these entitlements also needed to be set:com.apple.security.device.audio-input com.apple.security.device.microphone
Then the signtool must be run (and a cert may be required)
... however signing with these entitlements alone doesn't seem to fix the symptom.
We are marking this issue as stale because it has not been updated for a while. This is just a way to keep the support issues queue manageable. It will be closed soon unless the stale label is removed by a committer, or a new comment is made.
Fixed in 17.0.2 (but not backported)
Question
Why won't Java ask for Microphone access? How does one package a Java application so that will properly ask for permission to use the microphone?
Please see the following unit test: https://github.com/tresf/SoundRecorder.
javac SoundRecorder.java && java SoundRecorder
, from Terminal, it works.Reset with:
sudo tccutil reset Microphone com.apple.Terminal
SoundRecorder.java
, Run. It works.Reset with:
sudo tccutil reset Microphone com.jetbrains.intellij.ce
./package.sh
, double-clickSoundRecorer.app
. It doesn't work.Passing criteria:
.wav
file should contain audio, not silence.Some initial observations:
.wav
file for the specified duration. No prompt; no Java exceptions thrown.Java version tested:
AudioSystem.getLine(...).open(...)
Some general questions:
Related questions:
"VSCode terminal doesn't allow/request permissions to access media devices"
"Application doesn't ask for permission to access microphone in MacOS 10.14 Mojave"
"How to give Microphone permission to Java application (macOS Mojave and above)?"
"OpenCV command line app can't access camera under macOS Mojave"
"Cannot Access Microphone on Mac Mojave using pyaudio"
"How to record microphone on macos with pyaudio?"
Note: Big Sur can have caching issues between signing steps.