TorchControl TorchControl TorchControl TorchControl Class

Definition

Provides functionality for controlling the torch LED settings on a capture device.

public : sealed class TorchControl : ITorchControl
public sealed class TorchControl : ITorchControl
Public NotInheritable Class TorchControl Implements ITorchControl
// 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)

Remarks

The TorchControl enables apps to manage the torch LED on a device. This can used in capture apps or in non-capture app to do things like brighten a room.

You can find out if a device supports this control by checking TorchControl.Supported.

You can access the TorchControl for the capture device through MediaCapture.VideoDeviceController.

For how-to guidance for using the TorchControl, see Camera-independent Flashlight.

Properties

Enabled Enabled Enabled Enabled

Gets or sets a value that enables and disables the torch LED on the device.

public : Platform::Boolean Enabled { get; set; }
public bool Enabled { get; set; }
Public ReadWrite Property Enabled As bool
var bool = torchControl.enabled;
torchControl.enabled = bool;
Value
Platform::Boolean bool bool bool

true if the torch LED is enabled; otherwise, false.

Remarks

On some devices the torch will not emit light, even if Enabled is set to true, unless the device has a preview stream running and is actively capturing video. The recommended order of operations is to turn on the video preview, then turn on the torch by setting Enabled to true, and then initiate video capture. On some devices the torch will light up after the preview is started. On other devices, the torch may not light up until video capture is started.

PowerPercent PowerPercent PowerPercent PowerPercent

Gets or sets the intensity of the torch LED.

public : float PowerPercent { get; set; }
public float PowerPercent { get; set; }
Public ReadWrite Property PowerPercent As float
var float = torchControl.powerPercent;
torchControl.powerPercent = float;
Value
float float float float

The power percent the torch LED is set to.

PowerSupported PowerSupported PowerSupported PowerSupported

Gets a value that specifics if the device allows the torch LED power settings to be changed.

public : Platform::Boolean PowerSupported { get; }
public bool PowerSupported { get; }
Public ReadOnly Property PowerSupported As bool
var bool = torchControl.powerSupported;
Value
Platform::Boolean bool bool bool

true if the power settings can be modified; otherwise, false.

Supported Supported Supported Supported

Gets a value that specifies if the capture device supports the torch control.

public : Platform::Boolean Supported { get; }
public bool Supported { get; }
Public ReadOnly Property Supported As bool
var bool = torchControl.supported;
Value
Platform::Boolean bool bool bool

true if the capture device supports the torch control; otherwise, false.