I'm experiencing an issue where kAudioDevicePropertyDeviceIsRunningSomewhere
is not returning the expected values for wireless audio devices such as AirPods. The expected behavior is to return 1 when the device is in use and 0 when it is not. However, even when the device is actively being used, it consistently returns 0.
This problem seems to be a common one, as evidenced by discussions on platforms like the Apple Developer Forums and Stack Overflow.
https://developer.apple.com/forums/thread/741026
How to detect microphone usage on OS X?
I have attempted various methods to retrieve the correct value of kAudioDevicePropertyDeviceIsRunningSomewhere
for wireless devices but have not been successful. One peculiar observation is that when I use ListenerBlock
on kAudioDevicePropertyDeviceIsRunningSomewhere
, the ListenerBlock
is triggered, which is strange given that the property always reports the device as inactive, meaning "0".
Can anyone provide insights or solutions on how to accurately obtain the kAudioDevicePropertyDeviceIsRunningSomewhere
value for wireless audio devices?
After submitting an issue to Apple Developer Technical Support (DTS), I believe the problem has been resolved. I just tested with AirPods and it is now correctly returning 0, 1 for microphone usage.