changeMic method
Implementation
Future<void> changeMic(MediaDeviceInfo device,
[CustomTrack? customTrack]) async {
if (!isMobilePlatform()) {
if (_selectedAudioInput == device) {
return;
}
Span? changeMicSpan;
try {
if (videoSDKTelemetery != null) {
changeMicSpan =
videoSDKTelemetery!.trace(spanName: 'Changing Mic', attributes: [
Attribute.fromString(
'customTrack',
customTrack != null
? customTrack.toString()
: "Not using customTrack"),
Attribute.fromString("deviceId", device.deviceId),
Attribute.fromString("deviceLabel", device.label)
]);
}
} catch (error) {}
_selectedAudioInput = device;
await _disableMic(parentSpan: changeMicSpan);
await _enableMicImpl(customTrack: customTrack, parentSpan: changeMicSpan);
if (changeMicSpan != null) {
videoSDKTelemetery!.completeSpan(
span: changeMicSpan,
status: StatusCode.ok,
message: 'Change Mic Successful');
}
} else {
throw "Unsupported method for Mobile devices";
}
}