setCurrentDevice method

Future<int?> setCurrentDevice(
  1. int type,
  2. String deviceId
)

Specify the current device (Support for macOS, Windows and web platforms)

Parameters:

type Device type, which specifies the type of devices to be obtained. For more information, please see the definition of TXMediaDeviceType. type can only be TRTCCloudDef.TXMediaDeviceTypeMicTRTCCloudDef.TXMediaDeviceTypeSpeaker, or TRTCCloudDef.TXMediaDeviceTypeCamera.

deviceId Device ID obtained from getDevicesList

Return:

0: success; negative number: failure

Implementation

Future<int?> setCurrentDevice(int type, String deviceId
    ) async {
  var result = await _channel.invokeMethod('setCurrentDevice', {
    "type": type,
    "deviceId": deviceId
  });
  return V2TXLiveFlutterResult.intValue(result);
}