feat(electron): should listen to app audio input event for isRunning check (#11315)

fix AF-2435
This commit is contained in:
pengx17
2025-03-31 14:02:37 +00:00
parent 8957d0645f
commit ac096f533a

View File

@@ -16,8 +16,9 @@ use core_foundation::{
use coreaudio::sys::{
kAudioHardwarePropertyProcessObjectList, kAudioObjectPropertyElementMain,
kAudioObjectPropertyScopeGlobal, kAudioObjectSystemObject, kAudioProcessPropertyBundleID,
kAudioProcessPropertyIsRunning, kAudioProcessPropertyPID, AudioObjectAddPropertyListenerBlock,
AudioObjectID, AudioObjectPropertyAddress, AudioObjectRemovePropertyListenerBlock,
kAudioProcessPropertyIsRunning, kAudioProcessPropertyIsRunningInput, kAudioProcessPropertyPID,
AudioObjectAddPropertyListenerBlock, AudioObjectID, AudioObjectPropertyAddress,
AudioObjectRemovePropertyListenerBlock,
};
use libc;
use napi::{
@@ -422,7 +423,7 @@ impl TappableApplication {
pub fn get_is_running(&self) -> Result<bool> {
// Use catch_unwind to prevent any panics
let result = std::panic::catch_unwind(|| {
match get_process_property(&self.object_id, kAudioProcessPropertyIsRunning) {
match get_process_property(&self.object_id, kAudioProcessPropertyIsRunningInput) {
Ok(is_running) => Ok(is_running),
Err(_) => Ok(false),
}