VideoDeviceManager

Video device management methods.

enumerateVideoDevices

Enumerates the video devices.

List<VideoDeviceInfo> enumerateVideoDevices();

Details

Attention: This method is for Windows and macOS only.

Returns

  • Success: A VideoDeviceInfo array including all video devices in the system.
  • Failure: An empty array.

getCapability

Gets the detailed video frame information of the video capture device in the specified video format.

Future<VideoFormat> getCapability(
      {required String deviceIdUTF8, required int deviceCapabilityNumber});

Details

Attention: This method is for Windows and macOS only.

After calling numberOfCapabilities to get the number of video formats supported by the video capture device, you can call this method to get the specific video frame information supported by the specified index number.

Parameters

deviceIdUTF8
The ID of the video capture device.
deviceCapabilityNumber
The index number of the video format. If the return value of numberOfCapabilities is i, the value range of this parameter is [0,i).

Returns

The specific information of the specified video format, including width (px), height (px), and frame rate (fps). See VideoFormat.

getDevice

Retrieves the current video capture device.

Future<String> getDevice();

Details

Attention: This method is for Windows and macOS only.

Returns

The video capture device.

numberOfCapabilities

Gets the number of video formats supported by the specified video capture device.

Future<void> numberOfCapabilities(String deviceIdUTF8);

Details

Attention: This method is for Windows and macOS only.

Video capture devices may support multiple video formats, and each format supports different combinations of video frame width, video frame height, and frame rate.

You can call this method to get how many video formats the specified video capture device can support, and then call getCapability to get the specific video frame information in the specified video format.

Parameters

deviceIdUTF8
The ID of the video capture device.

Exceptions

When the method call succeeds, there is no return value; when fails, the AgoraRtcException exception is thrown. You need to catch the exception and handle it accordingly.

  • ≤ 0: Failure.

release

Releases all the resources occupied by the VideoDeviceManager object.

Future<void> release();

Details

Attention: This method is for Windows and macOS only.

setDevice

Specifies the video capture device with the device ID.

Future<void> setDevice(String deviceIdUTF8);

Details

Attention:
  • Plugging or unplugging a device does not change its device ID.
  • This method is for Windows and macOS only.

Parameters

deviceIdUTF8

The device ID. You can get the device ID by calling enumerateVideoDevices.

The maximum length is MaxDeviceIdLengthType.

Exceptions

When the method call succeeds, there is no return value; when fails, the AgoraRtcException exception is thrown. You need to catch the exception and handle it accordingly.