Media​Capture​Initialization​Settings Media​Capture​Initialization​Settings Media​Capture​Initialization​Settings Class

Definition

Contains initialization settings for the MediaCapture object which are passed to the MediaCapture.InitializeAsync method.

public sealed class MediaCaptureInitializationSettings : IMediaCaptureInitializationSettings, IMediaCaptureInitializationSettings2, IMediaCaptureInitializationSettings3, IMediaCaptureInitializationSettings4, IMediaCaptureInitializationSettings5, IMediaCaptureInitializationSettings6public sealed class MediaCaptureInitializationSettings : IMediaCaptureInitializationSettings, IMediaCaptureInitializationSettings2, IMediaCaptureInitializationSettings3, IMediaCaptureInitializationSettings4, IMediaCaptureInitializationSettings5, IMediaCaptureInitializationSettings6Public NotInheritable Class MediaCaptureInitializationSettings Implements IMediaCaptureInitializationSettings, IMediaCaptureInitializationSettings2, IMediaCaptureInitializationSettings3, IMediaCaptureInitializationSettings4, IMediaCaptureInitializationSettings5, IMediaCaptureInitializationSettings6
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
microphone microphone -capabilities webcam webcam

Remarks

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

Examples

The following example initializes the MediaCaptureInitializationSettings. Call InitializeAsync with these settings to initialize a MediaCapture object.

private void InitCaptureSettings()
{
    _captureInitSettings = null;
    _captureInitSettings = new Windows.Media.Capture.MediaCaptureInitializationSettings();
    _captureInitSettings.AudioDeviceId = "";
    _captureInitSettings.VideoDeviceId = "";
    _captureInitSettings.StreamingCaptureMode = Windows.Media.Capture.StreamingCaptureMode.AudioAndVideo;
    _captureInitSettings.PhotoCaptureSource = Windows.Media.Capture.PhotoCaptureSource.VideoPreview;
    
    if (_deviceList.Count > 0)
        _captureInitSettings.VideoDeviceId = _deviceList[0].Id;
}
// Initialize the MediaCaptureInitialzationSettings.
function initCaptureSettings() {
    captureInitSettings = null;
    captureInitSettings = new Windows.Media.Capture.MediaCaptureInitializationSettings();
    captureInitSettings.audioDeviceId = "";
    captureInitSettings.videoDeviceId = "";
    captureInitSettings.streamingCaptureMode = Windows.Media.Capture.StreamingCaptureMode.audioAndVideo;
    captureInitSettings.photoCaptureSource = Windows.Media.Capture.PhotoCaptureSource.photo;
    if (deviceList.length > 0)
        captureInitSettings.videoDeviceId = deviceList[0].id;
}

Constructors

MediaCaptureInitializationSettings() MediaCaptureInitializationSettings() MediaCaptureInitializationSettings()

Creates a new instance of the MediaCaptureInitializationSettings object.

public MediaCaptureInitializationSettings()public MediaCaptureInitializationSettings()Public Sub New()
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
microphone webcam

Properties

AlwaysPlaySystemShutterSound AlwaysPlaySystemShutterSound AlwaysPlaySystemShutterSound

Gets a value indicating whether the system should always play a shutter sound when a photo is captured.

public PlatForm::Boolean AlwaysPlaySystemShutterSound { get; set; }public bool AlwaysPlaySystemShutterSound { get; set; }Public ReadWrite Property AlwaysPlaySystemShutterSound As bool
Value
bool bool bool

True if the system should always play a shutter sound; otherwise, false.

Attributes
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)
Capabilities
microphone microphone -capabilities webcam webcam

Remarks

Some regions require that the system play a shutter sound whenever a photo is captured. Setting this value to true will cause the system to always play the shutter sound, whether or not is required by the current region. Setting this value to false will not suppress the system shutter sound when it is required.

AudioDeviceId AudioDeviceId AudioDeviceId

Gets the DeviceInformation.Id of the microphone.

public PlatForm::String AudioDeviceId { get; set; }public string AudioDeviceId { get; set; }Public ReadWrite Property AudioDeviceId As string
Value
string string string

The DeviceInformation.Id of the microphone.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
microphone webcam

Remarks

This method may return a NULL pointer if the device doesn't support this functionality. For more information, see the DeviceInformation class.

AudioProcessing AudioProcessing AudioProcessing

Gets or sets a value that specifies the audio processing mode.

public AudioProcessing AudioProcessing { get; set; }public AudioProcessing AudioProcessing { get; set; }Public ReadWrite Property AudioProcessing As AudioProcessing
Value
AudioProcessing AudioProcessing AudioProcessing

The audio processing mode.

Attributes

AudioSource AudioSource AudioSource

Gets or sets the audio source for the capture operation.

public IMediaSource AudioSource { get; set; }public IMediaSource AudioSource { get; set; }Public ReadWrite Property AudioSource As IMediaSource
Value
IMediaSource IMediaSource IMediaSource

The audio source for the capture operation.

Attributes

MediaCategory MediaCategory MediaCategory

Gets or set the media category.

public MediaCategory MediaCategory { get; set; }public MediaCategory MediaCategory { get; set; }Public ReadWrite Property MediaCategory As MediaCategory
Value
MediaCategory MediaCategory MediaCategory

The media category.

Attributes

Remarks

If you set the MediaCategory property, the media capture pipeline will attempt to optimize for the specified scenario. For example, if you set the value to Speech, audio processing such as echo cancellation and noise suppression may be enabled.

MemoryPreference MemoryPreference MemoryPreference

Gets or sets an object specifying the preferred memory location for storing frames acquired from a MediaFrameSource used by the MediaCapture.

public MediaCaptureMemoryPreference MemoryPreference { get; set; }public MediaCaptureMemoryPreference MemoryPreference { get; set; }Public ReadWrite Property MemoryPreference As MediaCaptureMemoryPreference
Value
MediaCaptureMemoryPreference MediaCaptureMemoryPreference MediaCaptureMemoryPreference

An object specifying preferred the memory location for storing frames acquired from a MediaFrameSource.

Attributes
Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)
Capabilities
microphone microphone -capabilities webcam webcam

Remarks

The MediaCapture object may store the image data of a VideoMediaFrame acquired from a MediaFrameSource in either CPU or GPU memory. When MemoryPreference is set to Cpu, CPU memory is used and therefore the SoftwareBitmap property of acquired VideoMediaFrame objects will be non-null and contain the image data for the frame. When Auto is specified, the system will dynamically choose the optimal memory location for the current device. If the system chooses to use GPU memory, the Direct3DSurface property of acquired VideoMediaFrame objects will be non-null and contain the image data for the frame.

PhotoCaptureSource PhotoCaptureSource PhotoCaptureSource

Gets or sets the stream that is used for photo capture.

public PhotoCaptureSource PhotoCaptureSource { get; set; }public PhotoCaptureSource PhotoCaptureSource { get; set; }Public ReadWrite Property PhotoCaptureSource As PhotoCaptureSource
Value
PhotoCaptureSource PhotoCaptureSource PhotoCaptureSource

The stream that is used for photo capture.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
microphone webcam

PhotoMediaDescription PhotoMediaDescription PhotoMediaDescription

Gets or sets the media description for photo capture.

public MediaCaptureVideoProfileMediaDescription PhotoMediaDescription { get; set; }public MediaCaptureVideoProfileMediaDescription PhotoMediaDescription { get; set; }Public ReadWrite Property PhotoMediaDescription As MediaCaptureVideoProfileMediaDescription
Attributes

Remarks

An instance of MediaCaptureVideoProfileMediaDescription defines a group of capture settings that are supported by a video profile. For example, one MediaCaptureVideoProfileMediaDescription object could represent settings for recording 720p video at 30 fps with HDR video and another could represent settings for recording 1080p video at 30 fps without HDR video support. A MediaCaptureVideoProfile object contains separate lists of supported media descriptions for photo capture, preview, and video recording that are supported for that profile. For more information on video profiles, see MediaCaptureVideoProfile.

The way the system uses the PhotoMediaDescription property depends on the value of the VideoProfile property.

PreviewMediaDescription PreviewMediaDescription PreviewMediaDescription

Gets or sets the media description for preview video.

public MediaCaptureVideoProfileMediaDescription PreviewMediaDescription { get; set; }public MediaCaptureVideoProfileMediaDescription PreviewMediaDescription { get; set; }Public ReadWrite Property PreviewMediaDescription As MediaCaptureVideoProfileMediaDescription
Attributes

Remarks

An instance of MediaCaptureVideoProfileMediaDescription defines a group of capture settings that are supported by a video profile. For example, one MediaCaptureVideoProfileMediaDescription object could represent settings for recording 720p video at 30 fps with HDR video and another could represent settings for recording 1080p video at 30 fps without HDR video support. A MediaCaptureVideoProfile object contains separate lists of supported media descriptions for photo capture, preview, and video recording that are supported for that profile. For more information on video profiles, see MediaCaptureVideoProfile.

The way the system uses the PreviewMediaDescription property depends on the value of the VideoProfile property.

RecordMediaDescription RecordMediaDescription RecordMediaDescription

Gets or sets the media description for video recording.

public MediaCaptureVideoProfileMediaDescription RecordMediaDescription { get; set; }public MediaCaptureVideoProfileMediaDescription RecordMediaDescription { get; set; }Public ReadWrite Property RecordMediaDescription As MediaCaptureVideoProfileMediaDescription
Attributes

Remarks

An instance of MediaCaptureVideoProfileMediaDescription defines a group of capture settings that are supported by a video profile. For example, one MediaCaptureVideoProfileMediaDescription object could represent settings for recording 720p video at 30 fps with HDR video and another could represent settings for recording 1080p video at 30 fps without HDR video support. A MediaCaptureVideoProfile object contains separate lists of supported media descriptions for photo capture, preview, and video recording that are supported for that profile. For more information on video profiles, see MediaCaptureVideoProfile.

The way the system uses the RecordMediaDescription property depends on the value of the VideoProfile property.

SharingMode SharingMode SharingMode

Gets or sets an object that specifies the sharing mode for the MediaCapture.

public MediaCaptureSharingMode SharingMode { get; set; }public MediaCaptureSharingMode SharingMode { get; set; }Public ReadWrite Property SharingMode As MediaCaptureSharingMode
Value
MediaCaptureSharingMode MediaCaptureSharingMode MediaCaptureSharingMode

An object that specifies the sharing mode for the MediaCapture.

Attributes
Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)
Capabilities
microphone microphone -capabilities webcam webcam

Remarks

Multiple apps can simultaneously acquire frames from the same MediaFrameSource, but only a single app can acquire exclusive control of and modify the settings for the frame source. Set SharingMode to ExclusiveControl if you need to adjust the configuration of any of the frame sources included the requested SourceGroup. However, this means that the call to InitializeAsync will fail if another app already has exclusive control of one of the frame sources in the group. If you only need to acquire frames without modifying the configuration, set SharingMode to SharedReadOnly.

SourceGroup SourceGroup SourceGroup

Gets or sets the MediaFrameSourceGroup with which the MediaCapture should be initialized. This property defines a set of media frame sources that can be used simultaneously.

public MediaFrameSourceGroup SourceGroup { get; set; }public MediaFrameSourceGroup SourceGroup { get; set; }Public ReadWrite Property SourceGroup As MediaFrameSourceGroup
Attributes
Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)
Capabilities
microphone microphone -capabilities webcam webcam

StreamingCaptureMode StreamingCaptureMode StreamingCaptureMode

Gets or sets the streaming mode.

public StreamingCaptureMode StreamingCaptureMode { get; set; }public StreamingCaptureMode StreamingCaptureMode { get; set; }Public ReadWrite Property StreamingCaptureMode As StreamingCaptureMode
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
microphone webcam

Remarks

Use this property to choose between audio capture, video capture, or combined audio and video capture.

VideoDeviceId VideoDeviceId VideoDeviceId

Gets the DeviceInformation.Id of the video camera.

public PlatForm::String VideoDeviceId { get; set; }public string VideoDeviceId { get; set; }Public ReadWrite Property VideoDeviceId As string
Value
string string string

The DeviceInformation.Id of the video camera.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
microphone webcam

Remarks

This method may return a NULL pointer if the device doesn't support this functionality. For more information, see the DeviceInformation class.

VideoProfile VideoProfile VideoProfile

Gets or sets the video profile which provides hints to the driver to allow it to optimize for different capture scenarios.

public MediaCaptureVideoProfile VideoProfile { get; set; }public MediaCaptureVideoProfile VideoProfile { get; set; }Public ReadWrite Property VideoProfile As MediaCaptureVideoProfile
Attributes

Remarks

Video profiles provide a simple way to configure the video capture device with a group of settings that are guaranteed to work with a particular capture device and are optimized for your desired capture scenario. There is a set of known video profiles that the system provides for common scenarios, such as capturing high-quality photos during video capture or video conferencing. To get a list of the known video profiles for a given video device, use MediaCapture::FindKnownVideoProfiles. Some hardware vendors may expose other video profiles that you can get by calling MediaCapture::FindAllVideoProfiles. For more information on video profiles, see MediaCaptureVideoProfile.

The value you use for this property determines how the system handles the values for other properties of the MediaCaptureInitializationSettings.

Before using video profiles, you should check the value returned by MediaCapture::IsVideoProfileSupported to make sure that video profiles are supported by the capture device.

For how-to guidance on using video profiles, see Discover and select camera capabilities with camera profiles

VideoSource VideoSource VideoSource

Gets or sets the video source for the capture operation.

public IMediaSource VideoSource { get; set; }public IMediaSource VideoSource { get; set; }Public ReadWrite Property VideoSource As IMediaSource
Value
IMediaSource IMediaSource IMediaSource

The video source for the capture operation.

Attributes