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, IMediaCaptureInitializationSettings6public sealed class MediaCaptureInitializationSettings : IMediaCaptureInitializationSettings, IMediaCaptureInitializationSettings2, IMediaCaptureInitializationSettings3, IMediaCaptureInitializationSettings4, IMediaCaptureInitializationSettings5, IMediaCaptureInitializationSettings6Public NotInheritable Class MediaCaptureInitializationSettings Implements IMediaCaptureInitializationSettings, IMediaCaptureInitializationSettings2, IMediaCaptureInitializationSettings3, IMediaCaptureInitializationSettings4, IMediaCaptureInitializationSettings5, IMediaCaptureInitializationSettings6// You can use this class in JavaScript.
- Attributes
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
| Capabilities |
webcam
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()// You can use this method in JavaScript.
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
| Capabilities |
webcam
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// You can use this property in JavaScript.
- Value
- PlatForm::Boolean bool bool bool
True if the system should always play a shutter sound; otherwise, false.
| Device family |
Windows 10 Creators Update (introduced v10.0.15063.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v4)
|
| Capabilities |
webcam
microphone
|
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// You can use this property in JavaScript.
- Value
- PlatForm::String string string string
The DeviceInformation.Id of the microphone.
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
| Capabilities |
webcam
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// You can use this property in JavaScript.
The audio processing mode.
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// You can use this property in JavaScript.
The audio source for the capture operation.
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// You can use this property in JavaScript.
The media category.
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// You can use this property in JavaScript.
- Value
- MediaCaptureMemoryPreference MediaCaptureMemoryPreference MediaCaptureMemoryPreference MediaCaptureMemoryPreference
An object specifying preferred the memory location for storing frames acquired from a MediaFrameSource.
| Device family |
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v3)
|
| Capabilities |
webcam
microphone
|
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// You can use this property in JavaScript.
The stream that is used for photo capture.
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
| Capabilities |
webcam
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// You can use this property in JavaScript.
- Value
- MediaCaptureVideoProfileMediaDescription MediaCaptureVideoProfileMediaDescription MediaCaptureVideoProfileMediaDescription MediaCaptureVideoProfileMediaDescription
The media description for photo capture.
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.
- If you set VideoProfile to a non-null value and you set PhotoMediaDescription to a value in the video profile's SupportedPhotoMediaDescription list, the system will use your provided media description and will provide optimization hints to the driver based on the profile you specify.
- If you set VideoProfile to a non-null value and the value of PhotoMediaDescription is not set, then the system will use the first entry in the video profile's SupportedPhotoMediaDescription list as the media description.
- If you set VideoProfile to null, the value you provide for PhotoMediaDescription is used, but no optimization hints are sent to the capture device. Also, if the value you provide for PhotoMediaDescription does not match an existing video profile, errors or glitches may occur when capture is started.
- If the value of VideoProfile is not set at all - not even to null - then the system ignores the value of PhotoMediaDescription and reverts to the legacy behavior before the video profile APIs were introduced.
- 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// You can use this property in JavaScript.
- Value
- MediaCaptureVideoProfileMediaDescription MediaCaptureVideoProfileMediaDescription MediaCaptureVideoProfileMediaDescription MediaCaptureVideoProfileMediaDescription
The media description for preview video.
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.
- If you set VideoProfile to a non-null value and you set PreviewMediaDescription to a value in the video profile's SupportedPreviewMediaDescription list, the system will use your provided media description and will provide optimization hints to the driver based on the profile you specify.
- If you set VideoProfile to a non-null value and the value of PreviewMediaDescription is not set, then the system will use the first entry in the video profile's SupportedPreviewMediaDescription list as the media description.
- If you set VideoProfile to null, the value you provide for PreviewMediaDescription is used, but no optimization hints are sent to the capture device. Also, if the value you provide for PreviewMediaDescription does not match an existing video profile, errors or glitches may occur when capture is started.
- If the value of VideoProfile is not set at all - not even to null - then the system ignores the value of PreviewMediaDescription and reverts to the legacy behavior before these APIs were introduced.
- 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// You can use this property in JavaScript.
- Value
- MediaCaptureVideoProfileMediaDescription MediaCaptureVideoProfileMediaDescription MediaCaptureVideoProfileMediaDescription MediaCaptureVideoProfileMediaDescription
The media description for video capture.
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.
- If you set VideoProfile to a non-null value and you set RecordMediaDescription to a value in the video profile's SupportedRecordMediaDescription list, the system will use your provided media description and will provide optimization hints to the driver based on the profile you specify.
- If you set VideoProfile to a non-null value and the value of RecordMediaDescription is not set, then the system will use the first entry in the video profile's SupportedRecordMediaDescription list as the media description.
- If you set VideoProfile to null, the value you provide for RecordMediaDescription is used, but no optimization hints are sent to the capture device. Also, if the value you provide for RecordMediaDescription does not match an existing video profile, errors or glitches may occur when capture is started.
- If the value of VideoProfile is not set at all - not even to null - then the system ignores the value of RecordMediaDescription and reverts to the legacy behavior before these APIs were introduced.
- 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// You can use this property in JavaScript.
- Value
- MediaCaptureSharingMode MediaCaptureSharingMode MediaCaptureSharingMode MediaCaptureSharingMode
An object that specifies the sharing mode for the MediaCapture.
| Device family |
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v3)
|
| Capabilities |
webcam
microphone
|
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// You can use this property in JavaScript.
The MediaFrameSourceGroup with which the MediaCapture should be initialized.
| Device family |
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v3)
|
| Capabilities |
webcam
microphone
|
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// You can use this property in JavaScript.
The streaming mode.
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
| Capabilities |
webcam
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// You can use this property in JavaScript.
- Value
- PlatForm::String string string string
The DeviceInformation.Id of the video camera.
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
| Capabilities |
webcam
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// You can use this property in JavaScript.
- Value
- MediaCaptureVideoProfile MediaCaptureVideoProfile MediaCaptureVideoProfile MediaCaptureVideoProfile
The video profile.
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.
- If you set VideoProfile to a valid MediaCaptureVideoProfile object, the system will use the driver hints associated with the profile and will use the media description values you specify for the PhotoMediaDescription, PreviewMediaDescription, and RecordMediaDescription properties.
- If you set VideoProfile to a valid MediaCaptureVideoProfile object and you don't set either the PhotoMediaDescription, PreviewMediaDescription, or RecordMediaDescription properties, the system will use the driver hints associated with the profile and use the first (0 index) entry in the profile's SupportedPhotoMediaDescription, SupportedPreviewMediaDescription, and SupportedRecordMediaDescription lists as the media description for the respective properties.
- If you set VideoProfile to null, the values you provide for PhotoMediaDescription, PreviewMediaDescription, and RecordMediaDescription are used, but no optimization hints are sent to the capture device. Also, if the value you provide for PhotoMediaDescription does not match an existing video profile, errors or glitches may occur when capture is started.
- If the value of VideoProfile is not set at all - not even to null - then the system ignores the value of PhotoMediaDescription, PreviewMediaDescription, and RecordMediaDescription and reverts to the legacy behavior before the video profile APIs were introduced.
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// You can use this property in JavaScript.
The video source for the capture operation.