mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-04-12 11:11:29 +03:00
Add detailed comments explaining microphone permission fix
Co-authored-by: rustdesk <71636191+rustdesk@users.noreply.github.com>
This commit is contained in:
@@ -209,10 +209,13 @@ class MainFlutterWindow: NSWindow {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
case "requestRecordAudio":
|
case "requestRecordAudio":
|
||||||
|
// Request microphone access and trigger system registration
|
||||||
|
// On macOS 13+, apps only appear in System Settings > Privacy & Security > Microphone
|
||||||
|
// after they actually attempt to use the microphone, not just request permission.
|
||||||
|
// We create a brief capture session to ensure proper registration.
|
||||||
AVCaptureDevice.requestAccess(for: .audio, completionHandler: { granted in
|
AVCaptureDevice.requestAccess(for: .audio, completionHandler: { granted in
|
||||||
if granted {
|
if granted {
|
||||||
// Actually instantiate an audio device to ensure macOS registers the app
|
// Instantiate an audio capture session to trigger macOS registration
|
||||||
// in System Settings > Privacy & Security > Microphone
|
|
||||||
if let audioDevice = AVCaptureDevice.default(for: .audio) {
|
if let audioDevice = AVCaptureDevice.default(for: .audio) {
|
||||||
do {
|
do {
|
||||||
let audioInput = try AVCaptureDeviceInput(device: audioDevice)
|
let audioInput = try AVCaptureDeviceInput(device: audioDevice)
|
||||||
|
|||||||
Reference in New Issue
Block a user