AudioManager audioManager = ((AudioManager) getSystemService(AUDIO_SERVICE));
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
audioManager.setSpeakerphoneOn(false);
--
---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/500d82be-d4b3-4973-8425-7df58fd064bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true);
WebRtcAudioUtils.setWebRtcBasedNoiseSuppressor(true);
Some phones can't do hardware echo cancellation, even though they advertise it's available. Redmi Note 5 is definitely one of them, take a look at https://github.com/signalapp/Signal-Android/blob/master/app/src/main/java/org/thoughtcrime/securesms/ApplicationContext.java, search for HARDWARE_AEC_BLACKLIST. So, to enable WebRTC AEC, use below methods of JavaAudioDeviceModule.class
setUseHardwareAcousticEchoCanceler(false)
setUseHardwareNoiseSuppressor(false)
(For reference, please have a look into createJavaAudioDevice() of PeerConnectionClient.java - Checkout official android example on googlesource.com