How to change the default webcam in CEF Sharp? - c#

Computer has two webcams. How to tell to CEFsharp from which camera start recording? How to switch cameras via C# on the fly? My case is to chage default camera for Hangouts chatting in CEFsharp browser in WPF project.
I tried to search some info on CEF's forums but did not find any workaround there.
As a solution i tried switch off device fully (throught devcon.exe) but it require to reboot PC and it is unacceptable for me.
More over there is no notion of "Default" device for web-cams in Windows. This mean, that i cant change default camera on OS level.
So i want to change it on level of CEFsharp.

Related

Keep Unity program working in background after device goes to sleep?

I'm working on a Unity project that uses the device camera for AR purposes (I'm using AR Foundation). I currently have it set so that the device won't go to sleep (because I want it to operate for long-periods without user-interaction). Specifically, Screen.sleepTImeout = SleepTimeout.NeverSleep. If I didn't have this, then the device would go to sleep, and the program would stop functioning. Does anyone know if there is a way to keep the program working in the background after the device goes to sleep...similar to how music apps keep playing music? I've come up empty handed after a few hours of searching for a solution. Any help would be greatly appreciated!!!
Some people aren't finding this in more recent versions of Unity. But it's still there: In Player settings, under the section "Resolution and Presentation", you find "Resolution" and below that, there's "Run In Background".
This is only available for Web players and standalones (Anything Except IOS And Android Pretty Much), though (you won't find it when you have the iOS, Android or Flash tab selected.

Windows 10 access keyboard light on laptop

I recently purchased a lenovo t420 laptop. I upgraded it with an SSD and did the update from 7 to 10. I then installed a clean image of windows 10, without all the bloatware. I would like to have access to the keyboard light without installing the Lenovo software. It isnt a backlight but is a single white LED next to the camera above the display. I see it come on for a split second when I cold boot the machine, I'm assuming this is part of the POST test or similar boot process and as such I would think there would be some way for me to connect to it.
I have tried using the new Lamp class in the windows 10 UWP API, and that doesnt work. I also tried using the device enumeration method and that doesnt show anything that looks like the LED.
Here is the code I tried so far, condensed a bit.
Lamp lamp = await Lamp.GetDefaultAsync();
this reults in lamp = null
string selectorString = Lamp.GetDeviceSelector();
DeviceInformationCollection devices = await DeviceInformation.FindAllAsync(selectorString);
this also results in null
this is the device enumeration code:
DeviceInformationCollection devices = devices = await light.EnumerateDevices();
This gives me about 291 different devices in the collection, none of which seem to match. I have held back on posting here as the list is long but can if requested.
Is there any way for me to access the LED through C#, if not C# than perhaps another language?
EDIT: I just found the keyboard key, I had bad info before, its Fn + Pgup. That works so i guess I dont need to write something myself but I am still curious as to why I cant find a hook to it.
As a learning exercise I would still like to know how to access the LED.
Ok, so I think this is as close as I am going to get to an answer and I would like to put it here for any future curious minds.
Here is a link to a page with a bunch of info on how to get at the ThinkLight from Linux and Windows.
http://www.thinkwiki.org/wiki/ThinkLight
And here is the important stuff in case the link breaks.
Controlling the ThinkLight with the keyboard works on all systems since it relies on the BIOS exclusively. Just press Fn+PageUp to toggle its state between on and off.
Starting with the ##30 series models (T430, T530, W530, etc), the keystroke was changed to Fn+Space in order to better accommodate the new 6-row keyboard layout. On models with backlit keyboards, there are 4 states: off, dim backlit, full backlit, and full backlit w/ ThinkLight. Models without backlit keyboards only have ThinkLight on and ThinkLight off, which can be obtained by disabling the backlit keyboard in the BIOS of models with backlit keyboards installed.
Software Control via thinkpad-acp
Software Control via thinkpad-acpi
Support for controlling the light with ACPI is provided by thinkpad-acpi. After installing it, a simple
# echo 255 > /sys/class/leds/tpacpi\:\:thinklight/brightness
switches it on and a
# echo 0 > /sys/class/leds/tpacpi\:\:thinklight/brightness
switches it off again.
This allows one to control the light in scripts. Unfortunately, no known ThinkPad comes with a light sensor (yet). ;)
To use these controls in scripts without root permissions, you should run
# chmod 666 /sys/class/leds/tpacpi\:\:thinklight/brightness, which is probably best done using udev.
Applications
led-notification: Pidgin plugin to use any LED to indicate new
messages. I've forked led-notification to support the ThinkLight via
thinkpad-acpi. The plugins below either weren't compatible with the
latest pidgin or didn't compile for me. The original author of
led-notification seems MIA. Another fork pidgin-led-notification to
write user defined strings (added to Gentoo/Linux)
gaim-thinklight: If you are using GAIM, the gaim-thinklight plugin
will enable you to use the ThinkLight as an indicator for new
messages. This depends on thinkpad-acpi.
gaim-lighthink: gaim-lightthink is an alternative to gaim-thinklight.
pidgin-blinklight:pidgin-blinklight is a replacement for
gaim-lighthink intended for use with Pidgin.
rocklight: rocklight is a xmms visualization plugin that makes the
ThinkLight flash to the beat of your music. The package also includes
a standalone stroboscope mode program.
thinkblinkd:[1] Thinkblinkd is a python daemon to control the
thinklight (and possibly other lights on your Thinkpad) it comes with
the daemon and a control script.
The script for theft alarm using HDAPS optionally flashes the
ThinkLight when the alarm is armed (disabled by default, to enable
set $use_light=1).
kopete-thinklight:[2] This plugin for kopete will enable the usage of
the thinklight as notifiaction for new messages. stupid little hack
to blink the ThinkLight: [3] A little C program that may be set SUID
so that you can use it from non-privileged programs that needs to do
a little notification.
thinkalert: [4] Another C program that may be set SUID to allow
non-privileged programs to manipulate the ThinkLight. Adds some
features over the "stupid little hack to blink the ThinkLight"
program.
thinklight-notification: This Evolution plugin notifies the user with
a blinking light whenever a new message has arrived.
ThinkBlink: blink.sh is an universal bash script making ThinkLight
blink. It can be used with any application.
Windows support
Likewise, controlling the ThinkLight with the keyboard works without any additional software. The Hotkey Features software from IBM/Lenovo adds OSD icons that appear when the light is turned on/off.
Software control via Hotkey Features
The Hotkey Features software exposes an interface that allows (among other things) to control the ThinkLight. See Python script for Windows to control ThinkPad features for more information

Intercept video frames in a WebRTC session for effects processing?

I have a C#/C++ app that captures a video stream from the camera connected to a user's PC. It then does user segmentation using the Intel RealSense SDK to automatically remove the background from the user. What I need to know is how to
insert myself into the video delivery chain so I get each frame, process it, and send it on to the WebRTC module.
The whole desired effect is to make the user look like they are superimposed over the web page. Note, the only browser I need to support is Chrome since I am running the Chromium DLLs in an embedded browser, thanks to the CefSharp project.
The one piece I can't figure out is to put myself into the video so I can get notified when a new video frame is available, modify it, and then pass it on to WebRTC in Chromium. I downloaded the Chromium source and can't find the keyword getUserMedia anywhere.
Since you are using a port of Chromium, this means that you should have access to WebGL calls through WebKit.
Instead of doing it on the app-side, try doing it on your HTML.
Since the question is "Intercept video frames in a WebRTC session for effects processing?" I think this post and the demo it has, which is on github, does exactly what you are asking for:
Using WebGL to apply effects to WebRTC video frames
And since WebGL shaders are basically written in C++ (GLSL), you could easily create a fragment/pixel shader which removes the background. Odds are that there's probably already one out there, it'd be worth trying to google for that one.
Also, in case performance concerns you, doing it this way would be just as fast since shaders work off of the GPU; even in mobile.

lock device (webcam) from other applications

I have an application that captures an image from a webcam.
I noticed that if I have Microsoft LifeCam installed in my computer, when starting the device from c#, Windows will start LifeCam automatically.
Obviously the easy way out is to uninstall LifeCam but is there a way to lock the device to my application only? The reason being is because I set image size, brightness, exposure, etc and when LifeCam starts, all of my settings are set to default.
Not that I know of. LifeCam is most likely using DirectShow to access the camera and while some directshow filters allow concurrent access, there isn't anything in the DirectShow API to let you prevent another application from trying to instantiate the driver. Usually what happens is that the second application gets a bunch of errors saying "Device in use", but sometimes not.
I think your best bet here is to just uninstall the lifecam software.

How to disable WebCam diode programmatically

In my laptop (Dell) strong blue diode light while WebCam use is annoying me.
I was thinking to disable it. Do you know any library or method to turn off this diode light?
I have done this, and it is completely possible without hardware modification on MOST (if not all) Dell webcams compatible with the Dell webcam software.
With older Dell Webcam Center software and drivers (~pre 2008), there is a setting which controls the LED during motion capture and it can be easily changed in the GUI.
For the newer Dell Webcam Central software, I had to use IDA/Cheat Engine/Hex Editor to manually debug and patch the driver DLL file. But this IS possible and only requires changing a couple of jmp instructions.

Categories