mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-12 19:17:58 +00:00
opt: add microphone permission tip
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import Cocoa
|
||||
import AVFoundation
|
||||
import FlutterMacOS
|
||||
import desktop_multi_window
|
||||
// import bitsdojo_window_macos
|
||||
@@ -81,6 +82,23 @@ class MainFlutterWindow: NSWindow {
|
||||
case "terminate":
|
||||
NSApplication.shared.terminate(self)
|
||||
result(nil)
|
||||
case "canRecordAudio":
|
||||
switch AVCaptureDevice.authorizationStatus(for: .audio) {
|
||||
case .authorized:
|
||||
result(1)
|
||||
break
|
||||
case .notDetermined:
|
||||
result(0)
|
||||
break
|
||||
default:
|
||||
result(-1)
|
||||
break
|
||||
}
|
||||
case "requestRecordAudio":
|
||||
AVCaptureDevice.requestAccess(for: .audio, completionHandler: { granted in
|
||||
result(granted)
|
||||
})
|
||||
break
|
||||
default:
|
||||
result(FlutterMethodNotImplemented)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user