Skip to content

Latest commit

 

History

History
37 lines (25 loc) · 1.91 KB

mediacapture_initializeasync_837464435.md

File metadata and controls

37 lines (25 loc) · 1.91 KB
-api-id -api-type
M:Windows.Media.Capture.MediaCapture.InitializeAsync(Windows.Media.Capture.MediaCaptureInitializationSettings)
winrt method

Windows.Media.Capture.MediaCapture.InitializeAsync

-description

Initializes the MediaCapture object.

-parameters

-param mediaCaptureInitializationSettings

The initialization settings.

-returns

Returns a IAsyncAction object that is used to control the asynchronous operation.

-remarks

InitializeAsync will launch a consent prompt to get the user's permission for the app to access the microphone or camera. InitializeAsync should be called from the main UI thread of your app. In apps that use C# or C++, the first use of the MediaCapture object to call InitializeAsync should be on the STA thread. Calls from an MTA thread may result in undefined behavior.

For how-to guidance on initializing and shutting down the MediaCapture object, see Basic photo, video, and audio capture with MediaCapture.

Starting with Windows, version 1803, InitializeAsync will return an error or throw an exception with an error code of 0xC00DAFC8 (MF_E_UNSUPPORTED_CAPTURE_DEVICE_PRESENT) when an unsupported capture device is detected. You can check for this error code and update your UI to alert to the user.

-examples

-see-also

InitializeAsync, Basic photo, video, and audio capture with MediaCapture

-capabilities

backgroundMediaRecording microphone, webcam