I recently upgraded my main desktop PC to Windows 8. When I did
that, the Microsoft LifeCam software stopped working. It was
recognized as incompatible with Windows 8. For most people, this is
not an issue, as it works perfectly fine with the built-in Windows
8 camera app.
For me, however, I need a small camera app sitting on my desktop
so I can see the hallway leading to my office. I call it the
heart-attack preventer, as it makes it difficult for my children to
sneak up on me when I'm heads-down at work. This is because I'm
surrounded by displays and simply can't see over them. My home
office is in the basement, with a combined TV room and play room
(plus a bunch of storage) surrounding it, so the kids often sneak
in here to say "Hi".
I installed the latest version of the LifeCam software, and it
doesn't install the desktop camera app at all. Bummer. I quickly
checked, and this is a common observation about that install.
Rather than spend all afternoon looking for a solution, I
figured it would be easier to code my own in 15 minutes. I
considered using WPF 4.5, but WebCam access in WPF requires
third-party toolkits or DirectX code (or Win32 API calls), so that
wouldn't do it. Coding a solution as a Windows Store app wouldn't
do, as I need a very tiny window on my desktop, not a snapped app.
I sometimes snap other apps and wouldn't want the webcam app to
limit that, or take up that amount of room.
Silverlight has always had extremely simple WebCam APIs that are
quick to use. (WinRT's APIs are just as easy if not easier).
I created a quick Silverlight 5 project in Visual Studio 2012.
Made it an out-of-browser app with elevated permissions, and put
this as the MainPage.xaml markup
<Grid x:Name="LayoutRoot" Background="White">
VerticalAlignment="Stretch" MouseLeftButtonDown="VideoOutput_MouseLeftButtonDown_1" />
And this as the code-behind:
public partial class MainPage : UserControl
Loaded += MainPage_Loaded;
void MainPage_Loaded(object sender, RoutedEventArgs e)
_devices = CaptureDeviceConfiguration.GetAvailableVideoCaptureDevices();
// specific to my system. Camera 1 is the one that points
// out of my home office. Camera 0 points at me.
if (_devices.Count > 1)
else if (_devices.Count > 0)
private void SetCaptureDevice(VideoCaptureDevice device)
var source = new CaptureSource();
source.VideoCaptureDevice = device;
var brush = new VideoBrush();
brush.Stretch = Stretch.UniformToFill;
VideoOutput.Fill = brush;
private void VideoOutput_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e)
I set the project properties for out of browser, no window
border, and elevated permissions (all covered in my Silverlight 5
book) and then installed the app. All done in about 15 minutes.
It took longer to write this post than it did to create the
This is hard-coded to my specific situation (second camera is
the camera which points away from my desk). I didn't bother with
icons, camera switching, or anything beyond what I needed for this
As a woodworker, I find it's sometimes quicker for me to build
something as opposed to search stores to find what I'm looking for.
As a programmer, sometimes it's faster just to code your
own solution rather than search the internet all day for