@ -256,7 +256,7 @@ class AudioModeModule extends ReactContextBaseJavaModule {
if ( mode ! = - 1 ) {
JitsiMeetLogger . i ( TAG + " User selected device set to: " + device ) ;
userSelectedDevice = device ;
updateAudioRoute ( mode ) ;
updateAudioRoute ( mode , false ) ;
}
}
} ) ;
@ -282,7 +282,7 @@ class AudioModeModule extends ReactContextBaseJavaModule {
boolean success ;
try {
success = updateAudioRoute ( mode ) ;
success = updateAudioRoute ( mode , false ) ;
} catch ( Throwable e ) {
success = false ;
JitsiMeetLogger . e ( e , TAG + " Failed to update audio route for mode: " + mode ) ;
@ -321,7 +321,7 @@ class AudioModeModule extends ReactContextBaseJavaModule {
* @return { @code true } if the audio route was updated successfully ;
* { @code false } , otherwise .
* /
private boolean updateAudioRoute ( int mode ) {
private boolean updateAudioRoute ( int mode , boolean force ) {
JitsiMeetLogger . i ( TAG + " Update audio route for mode: " + mode ) ;
if ( ! audioDeviceHandler . setMode ( mode ) ) {
@ -356,7 +356,7 @@ class AudioModeModule extends ReactContextBaseJavaModule {
// If the previously selected device and the current default one
// match, do nothing.
if ( selectedDevice ! = null & & selectedDevice . equals ( audioDevice ) ) {
if ( ! force & & selectedDevice ! = null & & selectedDevice . equals ( audioDevice ) ) {
return true ;
}
@ -421,7 +421,16 @@ class AudioModeModule extends ReactContextBaseJavaModule {
* /
void updateAudioRoute ( ) {
if ( mode ! = - 1 ) {
updateAudioRoute ( mode ) ;
updateAudioRoute ( mode , false ) ;
}
}
/ * *
* Re - sets the current audio route . Needed when focus is lost and regained .
* /
void resetAudioRoute ( ) {
if ( mode ! = - 1 ) {
updateAudioRoute ( mode , true ) ;
}
}