How to check if Apple MacBook webcam is used by any application(check if camera is on or off)

I have been searching for a bash or python (or something else)command to use in my python project, for checking if Apple MacBook webcam is used(check if camera is on or off) by any application or not. (Even I do not need the exact process id or name which use the camera)
Till now I have found 2 possible options, but both of them did not work properly:

1-lsof | grep "AppleCamera", lsof | grep "iSight" or lsof | grep "VDC" commands: These commands show the process ids and names which use the camera. But the problem is that these commands show also many processes which are not exactly using the camera too. For example, in same cases even if Facetime is minimized to dock(it means that the camera is not on, in idle mode.) these commands show Facetime application as an application which is occupying the camera (although it is not). Or in same cases some applications are shown as processes which use the camera, although the camera connection of application was already closed before.

2-oversight tool: Unfortunately it does not support any command line commands, so it is not possible to use in my python project.

Do you have any other recommendations to detect Apple MacBook camera status?
I would be grateful for your responses.
Thanks a lot in advance.

Replies

Any responses?

I would be really appreciated.
Hi, is there anyone there?