Chapter 15. Accessing Audio and Video Devices


  • Capturing a video frame

  • Capturing an audio stream

  • Saving a video frame as an image

Silverlight 4 adds new capability for accessing audio and video devices on your computer. You can access the audio from internal and external microphones and you can access video from webcams attached to your computer. This audio/video capability encompasses three key concepts:

  • Grabbing a video frame and converting it to a static image

  • Capturing/recording a complete audio or video feed for viewing later

  • Accessing raw audio or video feeds

With that list, you are probably seeing some interesting scenarios, including streaming the video or audio feed to other computers, using attached video devices to scan barcodes, recording audio for later use or distribution, or even creating an application that takes a photo and displays a security badge for printing using the new printing features in Silverlight 4. This chapter gives you the insight you need to access audio and video devices and work with the data that comes from them.


In an application that runs in the default sandbox of the browser, Silverlight prompts the user with a permissions dialog if an attempt is made to access microphone or camera devices. Figure 15-1 shows the permissions dialog that launches if your code attempts to access devices.

Figure 15-1

Figure 15-1. Figure 15-1 ...

Get Professional Silverlight® 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.