Take a look at the code for Objective-See’s “OverSight” utility; it is a good example of how to detect AV events system-wide. It’s also a really great app…
Their FAQ gives a sketch of how they detect AV events on Mac OS:
Q: Why does it take OverSight, a few seconds to display the webcam/mic usage notification?
A: There is not easy way to determine what process is using the webcam or mic, when either is activated. Worse, there is no direct indication that a new process is accessing an existing a webcam session. Thus OverSight has to perform various tests and has to poll the system (only when the camera/mic is active) in order to determine what process(es) is/are accessing the device. This takes a few seconds...mahalo for your patience!
It's able to detect camera and microphone activation/deactivation and logs it to stdout.
Currently figuring out how to detect when a new peripheral is connected.
Thank you! I couldn't originally figure this out for my "on air" script, so my workaround was to query the existance of the `zoom.us` process every second.
I had the same thought and then read the article. Turns out this is about telling other people in a shared space - such as a work from home situation - that you are in a meeting.
Which would not work for me as I generally keep the camera off to save bandwidth and the last remaining shreds of my sanity.