setCurrentDevice method

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

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


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

Returned value:

0: success; negative number: failure


Future<int?> setCurrentDevice(int type, String deviceId) {
  return _channel
      .invokeMethod('setCurrentDevice', {"type": type, "deviceId": deviceId});