MediaCapture.InitializeAsync MediaCapture.InitializeAsync MediaCapture.InitializeAsync MediaCapture.InitializeAsync MediaCapture.InitializeAsync Method

Definition

Overloads

InitializeAsync() InitializeAsync() InitializeAsync() InitializeAsync() InitializeAsync()

Initializes the MediaCapture object, using default settings.

InitializeAsync(MediaCaptureInitializationSettings) InitializeAsync(MediaCaptureInitializationSettings) InitializeAsync(MediaCaptureInitializationSettings) InitializeAsync(MediaCaptureInitializationSettings) InitializeAsync(MediaCaptureInitializationSettings)

Initializes the MediaCapture object.

InitializeAsync() InitializeAsync() InitializeAsync() InitializeAsync() InitializeAsync()

Initializes the MediaCapture object, using default settings.

public : IAsyncAction InitializeAsync()
IAsyncAction InitializeAsync() const;
public IAsyncAction InitializeAsync()
Public Function InitializeAsync() As IAsyncAction
Windows.Media.Capture.MediaCapture.initializeAsync().done( /* Your success and error handlers */ );

Returns

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

Additional features and requirements

Capabilities
webcam backgroundMediaRecording microphone

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.

See also

InitializeAsync(MediaCaptureInitializationSettings) InitializeAsync(MediaCaptureInitializationSettings) InitializeAsync(MediaCaptureInitializationSettings) InitializeAsync(MediaCaptureInitializationSettings) InitializeAsync(MediaCaptureInitializationSettings)

Initializes the MediaCapture object.

public : IAsyncAction InitializeAsync(MediaCaptureInitializationSettings mediaCaptureInitializationSettings)
IAsyncAction InitializeAsync(MediaCaptureInitializationSettings mediaCaptureInitializationSettings) const;
public IAsyncAction InitializeAsync(MediaCaptureInitializationSettings mediaCaptureInitializationSettings)
Public Function InitializeAsync(mediaCaptureInitializationSettings As MediaCaptureInitializationSettings) As IAsyncAction
Windows.Media.Capture.MediaCapture.initializeAsync(mediaCaptureInitializationSettings).done( /* Your success and error handlers */ );

Parameters

mediaCaptureInitializationSettings
MediaCaptureInitializationSettings MediaCaptureInitializationSettings MediaCaptureInitializationSettings

The initialization settings.

Returns

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

Additional features and requirements

Capabilities
webcam backgroundMediaRecording microphone

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.

See also