Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Is there a similar way of detecting the web cam in use on macOS?


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…

https://objective-see.com/products/oversight.html


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!


There has to be, as Micro Snitch tells me when it is.

EDIT: on my iMac M1 the built-in camera and mic are not detectable by MS. So, maybe not...

EDIT2: https://obdev.at/products/microsnitch/releasenotes.html

It's a bug in Big Sur, so hopefully it will be fixed and MS will work again.


I wanted to do the same so I started to write a small utility in Objective-C: https://github.com/ProZsolt/onair

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.


Here you go: https://stty.io/2020/07/31/lamp-control-based-on-video-confe...

I’ve been using this for ~1 and it’s been more reliable than I expected - no maintenance required even with the update to Big Sur.

To save you a click:

log show --predicate 'subsystem == "com.apple.VDCAssistant" && \ eventMessage CONTAINS[c] "kCameraStream"' --last 1m --no-debug --no-pager \ --style compact | tail -n +2)

#or log stream ... # streaming is better to generate events


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 was able to make something similar using Home Assistant to get the webcam status on the mac - https://willvaughan.design/making-an-on-air-light-for-my-hom...


My MacBook has a built-in green LED right next to the camera that turns on when the camera is on.


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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: