Show webcam images into Silverlight
With current Silverlight release or available beta you can't view webcam images from local machine so I thought to a trick to do it using a local winform application distributed using ClickOnce.
Here you are the result (YouTube video)
This sample work using two applications:
-
a winform application started navigating to the .application file, that runs a DirectShow graph to grab webcam images and send it through a Motion JPEG;
-
a silverlight application that uses socket connection to the local winform application to receive each frame from the webcam.
The winform application also implements policy server to trust socket connection from Silverlight to local application. From Silverlight prospective, it receive each jpeg frame and show it through the BitmapImage.SetSource method giving a fluid animation. It's a simple game and it allow only to capture and save webcam frames.
You can download full source code here. Enjoy!