MediaCaptureInitializationSettings MediaCaptureInitializationSettings MediaCaptureInitializationSettings MediaCaptureInitializationSettings 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, IMediaCaptureInitializationSettings6
public sealed class MediaCaptureInitializationSettings : IMediaCaptureInitializationSettings, IMediaCaptureInitializationSettings2, IMediaCaptureInitializationSettings3, IMediaCaptureInitializationSettings4, IMediaCaptureInitializationSettings5, IMediaCaptureInitializationSettings6
Public NotInheritable Class MediaCaptureInitializationSettings Implements IMediaCaptureInitializationSettings, IMediaCaptureInitializationSettings2, IMediaCaptureInitializationSettings3, IMediaCaptureInitializationSettings4, IMediaCaptureInitializationSettings5, IMediaCaptureInitializationSettings6
var mediaCaptureInitializationSettings = new mediaCaptureInitializationSettings();
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
webcam backgroundMediaRecording microphone

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;
}

Remarks

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

Constructors

MediaCaptureInitializationSettings() MediaCaptureInitializationSettings() MediaCaptureInitializationSettings() MediaCaptureInitializationSettings()

Creates a new instance of the MediaCaptureInitializationSettings object.

public : MediaCaptureInitializationSettings()
public MediaCaptureInitializationSettings()
Public Sub New()
var mediaCaptureInitializationSettings = new mediaCaptureInitializationSettings();
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
webcam backgroundMediaRecording microphone

Properties

AlwaysPlaySystemShutterSound 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
var bool = mediaCaptureInitializationSettings.alwaysPlaySystemShutterSound;
mediaCaptureInitializationSettings.alwaysPlaySystemShutterSound = bool;
Value
Platform::Boolean bool bool bool

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

Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)
Capabilities
backgroundMediaRecording

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 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
var string = mediaCaptureInitializationSettings.audioDeviceId;
mediaCaptureInitializationSettings.audioDeviceId = string;
Value
Platform::String string string string

The DeviceInformation.Id of the microphone.

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

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 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
var audioProcessing = mediaCaptureInitializationSettings.audioProcessing;
mediaCaptureInitializationSettings.audioProcessing = audioProcessing;
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
backgroundMediaRecording

AudioSource 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
var iMediaSource = mediaCaptureInitializationSettings.audioSource;
mediaCaptureInitializationSettings.audioSource = iMediaSource;
Value
IMediaSource IMediaSource IMediaSource IMediaSource

The audio source for the capture operation.

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

MediaCategory 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
var mediaCategory = mediaCaptureInitializationSettings.mediaCategory;
mediaCaptureInitializationSettings.mediaCategory = mediaCategory;
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
backgroundMediaRecording

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 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
var mediaCaptureMemoryPreference = mediaCaptureInitializationSettings.memoryPreference;
mediaCaptureInitializationSettings.memoryPreference = mediaCaptureMemoryPreference;
Value
MediaCaptureMemoryPreference MediaCaptureMemoryPreference MediaCaptureMemoryPreference MediaCaptureMemoryPreference

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

Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)
Capabilities
backgroundMediaRecording

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 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
var photoCaptureSource = mediaCaptureInitializationSettings.photoCaptureSource;
mediaCaptureInitializationSettings.photoCaptureSource = photoCaptureSource;
Value
PhotoCaptureSource PhotoCaptureSource PhotoCaptureSource PhotoCaptureSource

The stream that is used for photo capture.

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

PhotoMediaDescription 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
var mediaCaptureVideoProfileMediaDescription = mediaCaptureInitializationSettings.photoMediaDescription;
mediaCaptureInitializationSettings.photoMediaDescription = mediaCaptureVideoProfileMediaDescription;
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
backgroundMediaRecording

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.

See Also

PreviewMediaDescription 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
var mediaCaptureVideoProfileMediaDescription = mediaCaptureInitializationSettings.previewMediaDescription;
mediaCaptureInitializationSettings.previewMediaDescription = mediaCaptureVideoProfileMediaDescription;
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
backgroundMediaRecording

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.

See Also

RecordMediaDescription 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
var mediaCaptureVideoProfileMediaDescription = mediaCaptureInitializationSettings.recordMediaDescription;
mediaCaptureInitializationSettings.recordMediaDescription = mediaCaptureVideoProfileMediaDescription;
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
backgroundMediaRecording

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.

See Also

SharingMode 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
var mediaCaptureSharingMode = mediaCaptureInitializationSettings.sharingMode;
mediaCaptureInitializationSettings.sharingMode = mediaCaptureSharingMode;
Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)
Capabilities
backgroundMediaRecording

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 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
var mediaFrameSourceGroup = mediaCaptureInitializationSettings.sourceGroup;
mediaCaptureInitializationSettings.sourceGroup = mediaFrameSourceGroup;
Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)
Capabilities
backgroundMediaRecording

StreamingCaptureMode 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
var streamingCaptureMode = mediaCaptureInitializationSettings.streamingCaptureMode;
mediaCaptureInitializationSettings.streamingCaptureMode = streamingCaptureMode;
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
webcam backgroundMediaRecording microphone

Remarks

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

VideoDeviceId 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
var string = mediaCaptureInitializationSettings.videoDeviceId;
mediaCaptureInitializationSettings.videoDeviceId = string;
Value
Platform::String string string string

The DeviceInformation.Id of the video camera.

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

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 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
var mediaCaptureVideoProfile = mediaCaptureInitializationSettings.videoProfile;
mediaCaptureInitializationSettings.videoProfile = mediaCaptureVideoProfile;
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
backgroundMediaRecording

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 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
var iMediaSource = mediaCaptureInitializationSettings.videoSource;
mediaCaptureInitializationSettings.videoSource = iMediaSource;
Value
IMediaSource IMediaSource IMediaSource IMediaSource

The video source for the capture operation.

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