File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
android/src/main/java/com/zxcpoiu/incallmanager Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -789,7 +789,15 @@ public void setForceSpeakerphoneOn(final int flag) {
789789 Log .d (TAG , "setForceSpeakerphoneOn() flag: " + flag );
790790 forceSpeakerOn = flag ;
791791
792- selectAudioDevice ((flag == 1 ) ? AudioDevice .SPEAKER_PHONE : AudioDevice .NONE ); // --- will call updateAudioDeviceState()
792+ // --- will call updateAudioDeviceState()
793+ // --- Note: in some devices, it may not contains specified route thus will not be effected.
794+ if (flag == 1 ) {
795+ selectAudioDevice (AudioDevice .SPEAKER_PHONE );
796+ } else if (flag == -1 ) {
797+ selectAudioDevice (AudioDevice .EARPIECE ); // --- use the most common earpiece to force `speaker off`
798+ } else {
799+ selectAudioDevice (AudioDevice .NONE ); // --- NONE will follow default route, the default route of `video` call is speaker.
800+ }
793801 }
794802
795803 // --- TODO (zxcpoiu): Implement api to let user choose audio devices
You can’t perform that action at this time.
0 commit comments