Can you programatically tell if the webcam is in use?

Solution 1:

I would recommend OverSight because it's free and written by a very talented Apple technology focused security researcher. His other tools are also extremely good.

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