Captures a single photo or video from an attached camera.
Syntax
var cameraCaptureUI = new Windows.Media.Capture.CameraCaptureUI();
Attributes
- ActivatableAttribute(NTDDI_WIN8)
- MarshalingBehaviorAttribute(None)
- ThreadingAttribute(STA)
- VersionAttribute(NTDDI_WIN8)
Members
The CameraCaptureUI class has these types of members:
Constructors
The CameraCaptureUI class has these constructors.
| Constructor | Description |
|---|---|
| CameraCaptureUI | Create a new CameraCaptureUI object. |
Methods
The CameraCaptureUI class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.
| Method | Description |
|---|---|
| CaptureFileAsync | Creates an operation object for displaying the dialog that captures a photo or video. |
Properties
The CameraCaptureUI class has these properties.
| Property | Access type | Description |
|---|---|---|
| Read-only | Provides settings for capturing photos. | |
| Read-only | Provides settings for capturing videos. The settings include format, maximum resolution, maximum duration, and whether or not to allow trimming. |
Remarks
Note : 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 is not supported in N editions of Windows 8. Attempts to create a CameraCaptureUI will fail. Apps that use CameraCaptureUI should handle this failure gracefully.
Examples
The following example shows how to use the CameraCaptureUI class to take a picture. This example displays a message that indicates if the operation was successful.
// Take a photo using the default JPEG format. function takepicture() { var captureUI = new Windows.Media.Capture.CameraCaptureUI(); captureUI.captureFileAsync(Windows.Media.Capture.CameraCaptureUIMode.photo).then(function (capturedItem) { if (capturedItem) { document.getElementById("message").innerHTML = "User captured a photo." } else { document.getElementById("message").innerHTML = "User didn't capture a photo." } }); }
Requirements
|
Minimum supported client | Windows 8 [Windows Store apps only] |
|---|---|
|
Minimum supported server | Windows Server 2012 [Windows Store apps only] |
|
Namespace |
|
|
Metadata |
|
|
Capabilities |
|
See also
- Roadmaps
- Adding multimedia to Windows Store apps using C++, C#, or Visual Basic
- Adding multimedia to Windows Store apps using JavaScript
- Samples
- Camera capture UI sample
- Camera options UI sample
Build date: 12/4/2012