MediaDeviceControl MediaDeviceControl MediaDeviceControl MediaDeviceControl MediaDeviceControl Class

Definition

Gets or sets a device setting on a camera.

public : sealed class MediaDeviceControl : IMediaDeviceControl
struct winrt::Windows::Media::Devices::MediaDeviceControl : IMediaDeviceControl
public sealed class MediaDeviceControl : IMediaDeviceControl
Public NotInheritable Class MediaDeviceControl Implements IMediaDeviceControl
// This class does not provide a public constructor.
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 Capabilities

Gets the capabilities of the camera for this camera setting.

Methods

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

Indicates whether automatic adjustment of the camera setting is enabled.

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

Gets the value of the camera setting.

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

Enables or disables automatic adjustment of the camera setting.

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

Sets the camera setting.