Great approach and tool, super useful during WFH to respect family member's privacy, @wouterdebie, thanks for sharing!
After upgrading to an MBP with Apple silicon the built-in camera is no longer evaluated properly in isOn().
Printing out debug code just after
| CMIOObjectGetPropertyData(id, &STATUS_PA, 0, nil, dataSize, &dataUsed, data) |
is showing the following, camera is hence always on and it does not toggle when actually activating and deactivating it:
capture device: <AVCaptureDALDevice: 0x144611770 [FaceTime HD Camera][EAB7A68FEC2B4487AADFD8A91C1CB782]>, data pointee: 1
I am neither an expert in AVFoundation and CoreMedia and could not find any hints after some intense research so far on what has effectively changed for the new camera hardware and how to detect its state properly.
Maybe someone here does have the expertise to judge on how this could be fixed, happy to contribute then.