Skip to content

diveflo/WebcamLighting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Webcam Lighting

Automatically turn your Elgato Keylight on when your PC's webcam is in use. And off when it's not.

Install

Windows Service

Download the executable from GitHub and either run it directly or install as a (Windows) service. To install as a service, you can use sc.exe, e.g., like this:

sc.exe create "Webcam Lights" binPath= "C:\Users\youraccount\webcamlighting.exe" obj= ".\youraccount" password= "YourPassword"

Hint: The spaces after binPath, obj and password are required!

Hint: As the Bonjour-based discovery of the lights might require additional confirmation, please use your local admin account for the command above. Otherwise I observed non-descript error messages when trying to launch the service.

Linux Service

Use your favorite service manager to configure the service. The build output can be run via dotnet WebcamLighting.dll.

Build

The tool is based on .NET 8 and can therefore be easily build in Visual Studio or your favorite shell using:

dotnet build

How does this work?

Is the webcam used

Windows

Windows puts registry keys for each executable that ever used your webcam under

Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\webcam\NonPackaged

Each of those keys has a LastUsedTimeStop subkey. If that is 0, the process/executable is currently using your webcam.

Linux

Under Linux we check /dev/video for linkage.

Where are the lights and how to control them

Elgato Keylights are discovered using Bonjour which advertise under _elg._tcp.local. These devices provide a REST Api on port 9123 to get and set the light's current state (on/off, brightness, color temperature).

Extend for non-Elgato lights

Currently, this tool only works for Elgato Keylights. Non-Elgato lights would require two new classes implementing the ILightController and ILightManager interfaces and be wired into the DI setup in Program.cs

Thanks

@fleckmart figured out that there is a Windows registry key that can be used to determine if (and by whom) the system's webcam is currently being used (see fleckmart/windows_webcam_monitor).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages