MediaCapture.InitializeAsync Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
InitializeAsync() |
Initializes the MediaCapture object, using default settings. |
InitializeAsync(MediaCaptureInitializationSettings) |
Initializes the MediaCapture object. |
Initializes the MediaCapture object, using default settings.
public:
virtual IAsyncAction ^ InitializeAsync() = InitializeAsync;
/// [Windows.Foundation.Metadata.Overload("InitializeAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncAction InitializeAsync();
[Windows.Foundation.Metadata.Overload("InitializeAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncAction InitializeAsync();
function initializeAsync()
Public Function InitializeAsync () As IAsyncAction
Returns
Returns a IAsyncAction object that is used to control the asynchronous operation.
- Attributes
Windows requirements
App capabilities |
backgroundMediaRecording
microphone
webcam
|
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)
- Basic photo, video, and audio capture with MediaCapture
Applies to
WinRT Build 26100 and other versions
Product | Versions |
---|---|
WinRT | Build 10240, Build 10586, Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100 |
Initializes the MediaCapture object.
public:
virtual IAsyncAction ^ InitializeAsync(MediaCaptureInitializationSettings ^ mediaCaptureInitializationSettings) = InitializeAsync;
/// [Windows.Foundation.Metadata.Overload("InitializeWithSettingsAsync")]
IAsyncAction InitializeAsync(MediaCaptureInitializationSettings const& mediaCaptureInitializationSettings);
[Windows.Foundation.Metadata.Overload("InitializeWithSettingsAsync")]
public IAsyncAction InitializeAsync(MediaCaptureInitializationSettings mediaCaptureInitializationSettings);
function initializeAsync(mediaCaptureInitializationSettings)
Public Function InitializeAsync (mediaCaptureInitializationSettings As MediaCaptureInitializationSettings) As IAsyncAction
Parameters
- mediaCaptureInitializationSettings
- MediaCaptureInitializationSettings
The initialization settings.
Returns
Returns a IAsyncAction object that is used to control the asynchronous operation.
- Attributes
Windows requirements
App capabilities |
backgroundMediaRecording
microphone
webcam
|
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
Applies to
WinRT Build 26100 and other versions
Product | Versions |
---|---|
WinRT | Build 10240, Build 10586, Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100 |