toggleSpeakerphone method
Implementation
Future<void> toggleSpeakerphone(bool isSpeaker) async {
try {
final deviceName = isSpeaker ? 'SPEAKER_PHONE' : 'EARPIECE';
await EnxRtc.switchMediaDevice(deviceName);
selectedDevice.value = isSpeaker ? 'Speakerphone' : 'Earpiece';
} catch (e) {
print('Error in toggleSpeakerphone: $e');
}
}