kCMIODevicePropertyDeviceIsRunningSomewhere listener on macOS12

Hi,

I use following code to add listener for kCMIODevicePropertyDeviceIsRunningSomewhere to get using camera notification.

            opa.mSelector = kCMIODevicePropertyDeviceIsRunningSomewhere;

            opa.mScope = kCMIOObjectPropertyScopeGlobal;

            opa.mElement = kCMIOObjectPropertyElementMaster;

            result = CMIOObjectAddPropertyListenerBlock(CMIOObjectID(camera), &opa,NULL, CameralistenerBlock);

This code can work as expected before. But when I test it with macOS 12 on M1, the listener callback block is invoked by mistake when I open Music.app or iTunes.

When I run my application for two processes, the 1st process will get listener callback when the 2nd process invoke CMIOObjectAddPropertyListenerBlock.

Is it a bug of macOS 12? Or spec is changed? Any suggestion?

Thank you very much!

kCMIODevicePropertyDeviceIsRunningSomewhere listener on macOS12
 
 
Q