In April 2010, Microsoft released version 4 of Silverlight, the cross-browser, cross-platform, and cross-device plug-in required for building and running so-called "Rich Internet Applications." This version of Silverlight introduced several new features that developers can use for enhancing the user experience in their applications. Among these new features, Silverlight 4 introduced new APIs for interacting with devices such as webcams and microphones. In this article, I'll describe how the Visual Basic 2010 programming language can leverage webcams and microphones from Silverlight applications.
New Silverlight API Features
Basically, the new Silverlight APIs easily allow you to do the following:
- Retrieve the list of installed webcams and microphones.
- Get video and audio from selected devices.
- Capture "still images" from webcams asynchronously.
You use .NET namespaces and classes to access these kinds of devices, as described in the next section.
Namespaces and Classes
To access multimedia devices, you use classes exposed by the System.Windows.Media namespace. In particular, this namespace exposes the following classes:
- CaptureSource provides instance methods and properties for setting and accessing devices
- CaptureDeviceConfiguration implements shared methods that allow you to retrieve available devices
- VideoCaptureDevice represents a single video device such as a webcam
- AudioCaptureDevice represents a single audio device such as a microphone
The combination of these objects provides great control over devices, together with full integration with your applications.
In the next section, you'll learn how to build Silverlight applications that enable video and audio devices, and how to combine these new features with existing features such as data binding.