()
| 239 | // result over the TCC status API, which can be unreliable for ad-hoc |
| 240 | // signed or cross-architecture binaries (e.g., x64-on-arm64). |
| 241 | export async function requestMicrophonePermission(): Promise<boolean> { |
| 242 | const napi = await loadAudioNapi() |
| 243 | if (!napi.isNativeAudioAvailable()) { |
| 244 | return true // non-native platforms skip this check |
| 245 | } |
| 246 | |
| 247 | const started = await startRecording( |
| 248 | _chunk => {}, // discard audio data — this is a permission probe only |
| 249 | () => {}, // ignore silence-detection end signal |
| 250 | { silenceDetection: false }, |
| 251 | ) |
| 252 | if (started) { |
| 253 | stopRecording() |
| 254 | return true |
| 255 | } |
| 256 | return false |
| 257 | } |
| 258 | |
| 259 | export async function checkRecordingAvailability(): Promise<RecordingAvailability> { |
| 260 | // Remote environments have no local microphone |
no test coverage detected