This sample demonstrates how to use the MediaCapture API to capture video, audio, and pictures from a capture device, such as a webcam.

Specifically, this sample covers:

This sample has been updated for Windows 8.1. It now shows how to use the following new media capture features:

For more information on capturing video in your app, see Quickstart: capturing a photo or video using the camera dialog and Quickstart: capturing video using the MediaCapture API.

Important  

This sample uses the Media Extension feature of Windows 8.1 to add functionality to the Microsoft Media Foundation pipeline. A Media Extension consists of a hybrid object that implements both Component Object Model (COM) and Windows Runtime interfaces. The COM interfaces interact with the Media Foundation pipeline. The Windows Runtime interfaces activate the component and interact with the Windows Store app.

In most situations, it is recommended that you use Visual C++ with Component Extensions (C++/CX ) to interact with the Windows Runtime. But in the case of hybrid components that implement both COM and Windows Runtime interfaces, such as Media Extensions, this is not possible. C++/CX can only create Windows Runtime objects. So, for hybrid objects it is recommended that you use Windows Runtime C++ Template Library to interact with the Windows Runtime. Be aware that Windows Runtime C++ Template Library has limited support for implementing COM interfaces.

To obtain an evaluation copy of Windows 8.1, go to Windows 8.1.

To obtain an evaluation copy of Microsoft Visual Studio 2013, go to Visual Studio 2013.

Note  For Windows 8 app samples, download the Windows 8 app samples pack. The samples in the Windows 8 app samples pack will build and run only on Microsoft Visual Studio 2012.

Related topics

Windows 8 app samples
Roadmaps
Adding multimedia
Capturing or rendering audio, video, and images
Designing UX for apps
Roadmap for apps using C# and Visual Basic
Roadmap for apps using C++
Roadmap for apps using JavaScript
Tasks
Quickstart: capturing a photo or video using the camera dialog
Quickstart: capturing video using the MediaCapture API
Reference
AddEffectAsync
ClearEffectsAsync
MediaCapture
MediaCaptureSettings
MediaEncodingProfile
StartRecordToStorageFileAsync
Windows.Media.Capture

Operating system requirements

Client
Windows 8.1
Server
Windows Server 2012 R2

Build the sample

  1. Start Visual Studio 2013 and select File > Open > Project/Solution.
  2. Go to the directory in which you unzipped the sample. Go to the directory named for the sample, and double-click the Visual Studio 2013 Solution (.sln) file.
  3. Press F7 or use Build > Build Solution to build the sample.

Run the sample

To debug the app and then run it, press F5 or use Debug > Start Debugging. To run the app without debugging, press Ctrl+F5 or use Debug > Start Without Debugging.