Fixed speaker not activated when video call is started + prevent switch to speaker if using wired headset
This commit is contained in:
parent
39b3b4580a
commit
f5c2be45c0
3 changed files with 27 additions and 8 deletions
|
@ -205,6 +205,20 @@ public class AndroidAudioManager {
|
|||
return false;
|
||||
}
|
||||
|
||||
public synchronized boolean isWiredHeadsetAvailable() {
|
||||
for (AudioDevice audioDevice : LinphoneManager.getCore().getExtendedAudioDevices()) {
|
||||
Log.e("# AUDIO DEVICE TYPE IS " + audioDevice.getType().name());
|
||||
if (audioDevice.getType() == AudioDevice.Type.Headphones
|
||||
|| audioDevice.getType() == AudioDevice.Type.Headset) {
|
||||
Log.i(
|
||||
"[Audio Manager] Found headset/headphone device: ",
|
||||
audioDevice.getDeviceName());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public synchronized void routeAudioToBluetooth() {
|
||||
if (LinphoneManager.getCore().getCallsNb() == 0) return;
|
||||
Call currentCall = LinphoneManager.getCore().getCurrentCall();
|
||||
|
|
|
@ -407,15 +407,16 @@ public class CallActivity extends LinphoneGenericActivity
|
|||
} else if (state == Call.State.StreamsRunning) {
|
||||
mCallPausedByRemote.setVisibility(View.GONE);
|
||||
|
||||
setCurrentCallContactInformation();
|
||||
updateInterfaceDependingOnVideo();
|
||||
} else if (state == Call.State.Updating) {
|
||||
if (call.getCurrentParams().videoEnabled()) {
|
||||
if (!LinphoneManager.getAudioManager()
|
||||
.isUsingBluetoothAudioRoute()) {
|
||||
AndroidAudioManager manager = LinphoneManager.getAudioManager();
|
||||
if (!manager.isUsingBluetoothAudioRoute()
|
||||
&& !manager.isWiredHeadsetAvailable()) {
|
||||
LinphoneManager.getAudioManager().routeAudioToSpeaker();
|
||||
}
|
||||
}
|
||||
|
||||
setCurrentCallContactInformation();
|
||||
updateInterfaceDependingOnVideo();
|
||||
} else if (state == Call.State.UpdatedByRemote) {
|
||||
// If the correspondent asks for video while in audio call
|
||||
boolean videoEnabled = LinphonePreferences.instance().isVideoEnabled();
|
||||
|
@ -464,8 +465,11 @@ public class CallActivity extends LinphoneGenericActivity
|
|||
|
||||
if (videoEnabled) {
|
||||
mAudioManager = LinphoneManager.getAudioManager();
|
||||
mAudioManager.routeAudioToSpeaker();
|
||||
mSpeaker.setSelected(true);
|
||||
if (!mAudioManager.isWiredHeadsetAvailable()
|
||||
&& !mAudioManager.isUsingBluetoothAudioRoute()) {
|
||||
mAudioManager.routeAudioToSpeaker();
|
||||
mSpeaker.setSelected(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,7 +145,8 @@ public class CallManager {
|
|||
core.enableVideoCapture(true);
|
||||
core.enableVideoDisplay(true);
|
||||
|
||||
if (!LinphoneManager.getAudioManager().isUsingBluetoothAudioRoute()) {
|
||||
if (!LinphoneManager.getAudioManager().isUsingBluetoothAudioRoute()
|
||||
&& !LinphoneManager.getAudioManager().isWiredHeadsetAvailable()) {
|
||||
LinphoneManager.getAudioManager().routeAudioToSpeaker();
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue