Media​Device​Control 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// You can use this class in JavaScript.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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

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

Properties

Capabilities 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// You can use this property in JavaScript.
Value
MediaDeviceControlCapabilities MediaDeviceControlCapabilities MediaDeviceControlCapabilities MediaDeviceControlCapabilities

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

Methods

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

Indicates whether automatic adjustment of the camera setting is enabled.

public : PlatForm::Boolean TryGetAuto(bool value)public bool TryGetAuto(Boolean value)Public Function TryGetAuto(value As Boolean) As bool// You can use this method in JavaScript.
Parameters
value
bool Boolean Boolean Boolean

True if automatic adjustment is enabled; false otherwise.

Returns
PlatForm::Boolean bool bool bool

Returns true if the method succeeds, or false otherwise.

TryGetValue(Double) 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// You can use this method in JavaScript.
Parameters
value
double Double Double Double

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

Returns
PlatForm::Boolean bool bool bool

Returns true if the method succeeds, or false otherwise.

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

Enables or disables automatic adjustment of the camera setting.

public : PlatForm::Boolean TrySetAuto(bool value)public bool TrySetAuto(Boolean value)Public Function TrySetAuto(value As Boolean) As bool// You can use this method in JavaScript.
Parameters
value
bool Boolean Boolean Boolean

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

Returns
PlatForm::Boolean bool bool bool

Returns true if the method succeeds, or false otherwise.

Remarks

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

TrySetValue(Double) 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// You can use this method in JavaScript.
Parameters
value
double Double Double Double

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

Returns
PlatForm::Boolean bool bool bool

Returns true if the method succeeds, or false otherwise.