Python | Webcam Activity Notifier

GitHub | Windows Client

Recently I’ve been on Zoom meetings and Discord video calls when my wife walks in aware there’s a webcam pointing in the general direction of the door. I’ve always joked about making an “On-Air” sign to let her know when I’m streaming or in a video call.

Last night I got into writing the basic code for accepting Zoom webhooks and generic requests (from my keyboard or another device). It ended up being fairly simple, creating a FastAPI endpoint with a pydantic model and it was up and running

I’m making use of a Raspberry Pi Zero W, which gives me the flexibility of putting it in a shadowbox with a battery pack for a week or so. It also allows me to wirelessly update the Pi and have it serve the web endpoint itself.

This led me to wondering what other services support an API for meeting or call purposes.. turns out not many without a lot of administrative headaches if I wasn’t the tenant admin.

A random Stackexchange suggested monitoring the registry for webcam activity and it turns out HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\webcam\NonPackaged\
Contains a grouping of all programs that have accessed the web cam and the last time they’ve accessed it. If the LastUsedTimeStop key is 0, that means it’s actively in use

I put together WebcamWatcher to run on my computer with a 5 second loop, it checks the registry key and sends a post to the On-Air Pi to turn on the light. When it no longer detects the camera in use, it sends a post to turn off the light.

You can easily modify the package to support a broad range of actions when webcam activity is detected. I will caution, this has no way of detecting direct or malicious access to the webcam. Only legit Windows API calls are captured with this method

One thought on “Python | Webcam Activity Notifier

Comments are closed.