VideoDeviceManager
Methods for managing video devices.
enumerateVideoDevices
Gets a list of all video devices on the system.
List<VideoDeviceInfo> enumerateVideoDevices();
Return Values
- On success: Returns an array of VideoDeviceInfo containing all video devices on the system.
- On failure: Returns an empty list.
getCapability
Gets detailed video frame information for a video capture device under a specified video format.
Future<VideoFormat> getCapability(
{required String deviceIdUTF8, required int deviceCapabilityNumber});
After calling numberOfCapabilities to get the number of supported video formats for a video capture device, you can call this method to get detailed video frame information for the specified index.
Parameters
- deviceIdUTF8
- The ID of the video capture device.
- deviceCapabilityNumber
- The index of the video format. If the return value of numberOfCapabilities is i, then the valid range for this parameter is [0, i).
Return Values
Detailed information of the specified video format, including width (px), height (px), and frame rate (fps). See VideoFormat.
getDevice
Gets the currently used video capture device.
Future<String> getDevice();
Return Values
The video capture device.
numberOfCapabilities
Gets the number of video formats supported by the specified video capturing device.
Future<void> numberOfCapabilities(String deviceIdUTF8);
A video capturing device may support multiple video formats, each with different combinations of frame width, frame height, and frame rate. You can call this method to get how many video formats the specified video capturing device supports, and then call getCapability to get detailed frame information for a specific video format.
Parameters
- deviceIdUTF8
- The ID of the video capturing device.
Return Values
- ≤ 0: The method call fails. See Error Codes for details and resolution suggestions.
release
Releases all resources occupied by the VideoDeviceManager object.
Future<void> release();
setDevice
Specifies the video capture device by device ID.
Future<void> setDevice(String deviceIdUTF8);
- Plugging or unplugging a device does not change the device ID.
- This method is applicable only to Windows and macOS.
Parameters
- deviceIdUTF8
- Device ID. You can get it by calling enumerateVideoDevices. The maximum length is MaxDeviceIdLengthType.
Return Values
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. See Error Codes for details and resolution suggestions.