setCurrentDevice method
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.TXMediaDeviceTypeMic、TRTCCloudDef.TXMediaDeviceTypeSpeaker, or TRTCCloudDef.TXMediaDeviceTypeCamera.
deviceId
Device ID obtained from getDevicesList
Returned value:
0
: success; negative number: failure
Implementation
Future<int?> setCurrentDevice(int type, String deviceId) {
return _channel
.invokeMethod('setCurrentDevice', {"type": type, "deviceId": deviceId});
}