Media​Device​Control Media​Device​Control Media​Device​Control Class

Definition

Gets or sets a device setting on a camera.

public sealed class MediaDeviceControl : IMediaDeviceControlpublic sealed class MediaDeviceControl : IMediaDeviceControlPublic NotInheritable Class MediaDeviceControl Implements IMediaDeviceControl
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

Various properties on the VideoDeviceController object returns instances of the MediaDeviceControl object. Each VideoDeviceController property represents a particular setting on the camera, such as brightness or focus. Use the MediaDeviceControl object to:

  • Get or set the camera setting.
  • Enable automatic adjustment of the setting.
  • Get the range of values that the camera supports for the setting.
Note

: This class is not agile, which means that you need to consider its threading model and marshaling behavior. For more info, see Threading and Marshaling (C++/CX) and Using Windows Runtime objects in a multithreaded environment (.NET).

Examples

The following example shows how to get the Brightness on a VideoDeviceController. Note that Brightness is a MediaDeviceController.

// Get the step size, minimum value, and maximum value of the brightness property to set
// values on a slider control.

function setBrtSlider() {
    var videoDev = null;
    var bValue = null;

    var mediaDevice = new Windows.Media.Capture.MediaCapture();
    videoDev = mediaDevice.videoDeviceController;
   
    if (videoDev.brightness.capabilities.step !== 0)
    {
        bValue = videoDev.brightness.tryGetValue();
        document.getElementById("slBrt").value = bValue.value;
        document.getElementById("slBrt").min = videoDev.brightness.capabilities.min;
        document.getElementById("slBrt").max = videoDev.brightness.capabilities.max;
        document.getElementById("slBrt").step = videoDev.brightness.capabilities.step;
    }
} 

Properties

Capabilities Capabilities Capabilities

Gets the capabilities of the camera for this camera setting.

public MediaDeviceControlCapabilities Capabilities { get; }public MediaDeviceControlCapabilities Capabilities { get; }Public ReadOnly Property Capabilities As MediaDeviceControlCapabilities
Value
MediaDeviceControlCapabilities MediaDeviceControlCapabilities MediaDeviceControlCapabilities

The capabilities, including the supported range of values, the default value, and the step size.

Attributes

Methods

TryGetAuto(Boolean) TryGetAuto(Boolean) TryGetAuto(Boolean)

Indicates whether automatic adjustment of the camera setting is enabled.

public PlatForm::Boolean TryGetAuto(Boolean value)public bool TryGetAuto(Boolean value)Public Function TryGetAuto(value As Boolean) As bool
Parameters
value
System.Boolean System.Boolean System.Boolean

True if automatic adjustment is enabled; false otherwise.

Returns
bool bool bool

Returns true if the method succeeds, or false otherwise.

Attributes

TryGetValue(Double) TryGetValue(Double) TryGetValue(Double)

Gets the value of the camera setting.

public PlatForm::Boolean TryGetValue(Double value)public bool TryGetValue(Double value)Public Function TryGetValue(value As Double) As bool
Parameters
value
System.Double System.Double System.Double

The current value of the setting. The units depend on the setting.

Returns
bool bool bool

Returns true if the method succeeds, or false otherwise.

Attributes

TrySetAuto(Boolean) TrySetAuto(Boolean) TrySetAuto(Boolean)

Enables or disables automatic adjustment of the camera setting.

public PlatForm::Boolean TrySetAuto(Boolean value)public bool TrySetAuto(Boolean value)Public Function TrySetAuto(value As Boolean) As bool
Parameters
value
System.Boolean System.Boolean System.Boolean

True to enable automatic adjustment; or false to disable automatic adjustment. If false, call TrySetValue to adjust the setting.

Returns
bool bool bool

Returns true if the method succeeds, or false otherwise.

Attributes

Remarks

Depending on the setting and the camera model, the camera might not support automatic adjustment.

TrySetValue(Double) TrySetValue(Double) TrySetValue(Double)

Sets the camera setting.

public PlatForm::Boolean TrySetValue(Double value)public bool TrySetValue(Double value)Public Function TrySetValue(value As Double) As bool
Parameters
value
System.Double System.Double System.Double

The new value of the camera setting. The units depend on the setting.

Returns
bool bool bool

Returns true if the method succeeds, or false otherwise.

Attributes