MediaCaptureInitializationSettings MediaCaptureInitializationSettings MediaCaptureInitializationSettings MediaCaptureInitializationSettings Class

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

Syntax

Declaration

public sealed class MediaCaptureInitializationSettingspublic sealed class MediaCaptureInitializationSettingsPublic NotInheritable Class MediaCaptureInitializationSettingspublic sealed class MediaCaptureInitializationSettings

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(MediaCaptureInitializationSettings) 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 summary

Creates a new instance of the @Windows.Media.Capture.MediaCaptureInitializationSettings.#ctor object.

Properties summary

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

Gets the Id of the microphone.

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

Gets or sets the audio source for the capture operation.

Gets or set the media category.

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

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

Gets or sets the media description for photo capture.

Gets or sets the media description for preview video.

Gets or sets the media description for video recording.

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

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.

Gets or sets the streaming mode.

Gets the Id of the video camera.

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

Gets or sets the video source for the capture operation.

Constructors

  • MediaCaptureInitializationSettings()
    MediaCaptureInitializationSettings()
    MediaCaptureInitializationSettings()
    MediaCaptureInitializationSettings()

    Creates a new instance of the @Windows.Media.Capture.MediaCaptureInitializationSettings.#ctor object.

    public MediaCaptureInitializationSettings()public New()Public Sub New()public MediaCaptureInitializationSettings()

Properties

  • AlwaysPlaySystemShutterSound
    AlwaysPlaySystemShutterSound
    AlwaysPlaySystemShutterSound
    AlwaysPlaySystemShutterSound

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

    public bool AlwaysPlaySystemShutterSound { get; set; }public bool AlwaysPlaySystemShutterSound { get; set; }Public ReadWrite Property AlwaysPlaySystemShutterSound As boolpublic bool AlwaysPlaySystemShutterSound { get; set; }

    Property Value

    • bool
      bool
      bool
      bool

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

    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 Id of the microphone.

    public string AudioDeviceId { get; set; }public string AudioDeviceId { get; set; }Public ReadWrite Property AudioDeviceId As stringpublic string AudioDeviceId { get; set; }

    Property Value

    • string
      string
      string
      string

      The Id of the 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 AudioProcessingpublic AudioProcessing AudioProcessing { get; set; }

    Property Value

  • 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 IMediaSourcepublic IMediaSource AudioSource { get; set; }

    Property Value

  • 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 MediaCategorypublic MediaCategory MediaCategory { get; set; }

    Property Value

    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 MediaCategory, 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 MediaCaptureMemoryPreferencepublic MediaCaptureMemoryPreference MemoryPreference { get; set; }

    Property Value

    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 MediaCaptureMemoryPreference, 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 MediaCaptureMemoryPreference 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 PhotoCaptureSourcepublic PhotoCaptureSource PhotoCaptureSource { get; set; }

    Property Value

  • 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 MediaCaptureVideoProfileMediaDescriptionpublic MediaCaptureVideoProfileMediaDescription PhotoMediaDescription { get; set; }

    Property Value

    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
    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 MediaCaptureVideoProfileMediaDescriptionpublic MediaCaptureVideoProfileMediaDescription PreviewMediaDescription { get; set; }

    Property Value

    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
    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 MediaCaptureVideoProfileMediaDescriptionpublic MediaCaptureVideoProfileMediaDescription RecordMediaDescription { get; set; }

    Property Value

    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
    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 MediaCaptureSharingModepublic MediaCaptureSharingMode SharingMode { get; set; }

    Property Value

    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 MediaCaptureSharingMode 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 MediaCaptureSharingMode.

  • 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 MediaFrameSourceGrouppublic MediaFrameSourceGroup SourceGroup { get; set; }

    Property Value

  • 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 StreamingCaptureModepublic StreamingCaptureMode StreamingCaptureMode { get; set; }

    Property Value

    Remarks

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

  • VideoDeviceId
    VideoDeviceId
    VideoDeviceId
    VideoDeviceId

    Gets the Id of the video camera.

    public string VideoDeviceId { get; set; }public string VideoDeviceId { get; set; }Public ReadWrite Property VideoDeviceId As stringpublic string VideoDeviceId { get; set; }

    Property Value

    • string
      string
      string
      string

      The Id of the video camera.

    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 MediaCaptureVideoProfilepublic MediaCaptureVideoProfile VideoProfile { get; set; }

    Property Value

    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 FindKnownVideoProfiles(String, KnownVideoProfile). Some hardware vendors may expose other video profiles that you can get by calling FindAllVideoProfiles(String). 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 IsVideoProfileSupported(String) 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 IMediaSourcepublic IMediaSource VideoSource { get; set; }

    Property Value

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Capabilities

microphone
microphone -capabilities webcam
webcam

Attributes

Windows.Foundation.Metadata.ActivatableAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.DualApiPartitionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.ThreadingAttribute

Details

Assembly

Windows.Media.Capture.dll