CameraCaptureUI CameraCaptureUI CameraCaptureUI CameraCaptureUI CameraCaptureUI Class


Provides a full window UI for capturing audio, video, and photos from a camera. As well as controls for trimming video, time delayed capture, and camera settings.

public : sealed class CameraCaptureUI
struct winrt::Windows::Media::Capture::CameraCaptureUI
public sealed class CameraCaptureUI
Public NotInheritable Class CameraCaptureUI
var cameraCaptureUI = new cameraCaptureUI();

Windows 10 requirements

Device family
Windows 10 (introduced v10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
webcam microphone


This code shows how to use the CameraCaptureUI class to take a picture. The code is from file CapturePhoto.xaml.cs of the Camera capture UI sample. The dialog with the user occurs when you call the asynchronous method CaptureFileAsync.

// Using Windows.Media.Capture.CameraCaptureUI API to capture a photo
CameraCaptureUI dialog = new CameraCaptureUI();
Size aspectRatio = new Size(16, 9);
dialog.PhotoSettings.CroppedAspectRatio = aspectRatio;

StorageFile file = await dialog.CaptureFileAsync(CameraCaptureUIMode.Photo);
// Using Windows.Media.Capture.CameraCaptureUI API to capture a photo
var dialog = new Windows.Media.Capture.CameraCaptureUI();
var aspectRatio = { width: 1, height: 1 };
dialog.photoSettings.croppedAspectRatio = aspectRatio;
dialog.captureFileAsync( (file) {
    if (file) {
        var photoBlobUrl = URL.createObjectURL(file, { oneTimeOnly: true });
        document.getElementById("capturedPhoto").src = photoBlobUrl;
        document.getElementById("resetButton").style.visibility = "visible";
        localSettings.values[photoKey] = file.path;
    } else {
        WinJS.log && WinJS.log("No photo captured.", "sample", "status");
}, function (err) {
    WinJS.log && WinJS.log(err, "sample", "error");


CameraCaptureUI provides a full window UI experience for capturing audio, video, and images. It provides controls for setting a time delay on photo captures, trimming video, and for adjusting the camera's settings such as video resolution, the audio device, brightness, and contrast.

Call CaptureFileAsync to launch the UI. The user has control over when to start the capture. When the asynchronous CaptureFileAsync operation completes, a StorageFile object is returned. For how-to guidance for using CameraCaptureUI, see Capture photos and video with Windows built-in camera UI


You should not specify the webcam or microphone capabilities in your app manifest file if you are using CameraCaptureUI. If you do so, your app will be displayed in the device's camera privacy settings, but even if the user denies camera access to your app, it will not prevent the CameraCaptureUI from capturing media. This is because the Windows built-in camera app is a trusted first-party app that requires the user to initiate photo, audio, and video capture with a button press. Your app may fail Windows Application Certification Kit certification when submitted to the Store if you specify the webcam or microphone capabilities when using CameraCaptureUI.

You must specify the webcam or microphone capabilities in your app manifest file if you are using MediaCapture to capture audio, photos, or video programmatically.


This class is not agile, which means that you need to consider its threading model and marshaling behavior. For more info, see Threading and Marshaling (C++/CX) and Using Windows Runtime objects in a multithreaded environment (.NET).


CameraCaptureUI() CameraCaptureUI() CameraCaptureUI() CameraCaptureUI() CameraCaptureUI()

Create a new CameraCaptureUI object.


PhotoSettings PhotoSettings PhotoSettings PhotoSettings PhotoSettings

Provides settings for capturing photos. The settings include aspect ratio, image size, format, resolution, and whether or not cropping is allowed by the user interface (UI).

VideoSettings VideoSettings VideoSettings VideoSettings VideoSettings

Provides settings for capturing videos. The settings include format, maximum resolution, maximum duration, and whether or not to allow trimming.


CaptureFileAsync(CameraCaptureUIMode) CaptureFileAsync(CameraCaptureUIMode) CaptureFileAsync(CameraCaptureUIMode) CaptureFileAsync(CameraCaptureUIMode) CaptureFileAsync(CameraCaptureUIMode)

Launches the CameraCaptureUI user interface.

See also