Account for conference in audio route utils
This commit is contained in:
parent
7f30e9d874
commit
465ac2db74
1 changed files with 47 additions and 16 deletions
|
@ -32,14 +32,21 @@ class AudioRouteUtils {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val currentCall = call ?: coreContext.core.currentCall ?: coreContext.core.calls[0]
|
val currentCall = call ?: coreContext.core.currentCall ?: coreContext.core.calls[0]
|
||||||
|
val conference = coreContext.core.conference
|
||||||
|
|
||||||
for (audioDevice in coreContext.core.audioDevices) {
|
for (audioDevice in coreContext.core.audioDevices) {
|
||||||
if (audioDevice.type == AudioDevice.Type.Earpiece) {
|
if (audioDevice.type == AudioDevice.Type.Earpiece) {
|
||||||
Log.i("[Audio Route Helper] Found earpiece audio device [${audioDevice.deviceName}], routing audio to it")
|
if (conference != null && conference.isIn) {
|
||||||
|
Log.i("[Audio Route Helper] Found earpiece audio device [${audioDevice.deviceName}], routing audio of conference to it")
|
||||||
|
conference.outputAudioDevice = audioDevice
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
Log.i("[Audio Route Helper] Found earpiece audio device [${audioDevice.deviceName}], routing audio of call to it")
|
||||||
currentCall.outputAudioDevice = audioDevice
|
currentCall.outputAudioDevice = audioDevice
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Log.e("[Audio Route Helper] Couldn't find earpiece audio device")
|
Log.e("[Audio Route Helper] Couldn't find earpiece audio device")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,15 +55,23 @@ class AudioRouteUtils {
|
||||||
Log.e("[Audio Route Helper] No call found, aborting speaker audio route change")
|
Log.e("[Audio Route Helper] No call found, aborting speaker audio route change")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val currentCall = call ?: coreContext.core.currentCall ?: coreContext.core.calls[0]
|
val currentCall = call ?: coreContext.core.currentCall ?: coreContext.core.calls[0]
|
||||||
|
val conference = coreContext.core.conference
|
||||||
|
|
||||||
for (audioDevice in coreContext.core.audioDevices) {
|
for (audioDevice in coreContext.core.audioDevices) {
|
||||||
if (audioDevice.type == AudioDevice.Type.Speaker) {
|
if (audioDevice.type == AudioDevice.Type.Speaker) {
|
||||||
Log.i("[Audio Route Helper] Found speaker audio device [${audioDevice.deviceName}], routing audio to it")
|
if (conference != null && conference.isIn) {
|
||||||
|
Log.i("[Audio Route Helper] Found speaker audio device [${audioDevice.deviceName}], routing audio of conference to it")
|
||||||
|
conference.outputAudioDevice = audioDevice
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
Log.i("[Audio Route Helper] Found speaker audio device [${audioDevice.deviceName}], routing audio of call to it")
|
||||||
currentCall.outputAudioDevice = audioDevice
|
currentCall.outputAudioDevice = audioDevice
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Log.e("[Audio Route Helper] Couldn't find speaker audio device")
|
Log.e("[Audio Route Helper] Couldn't find speaker audio device")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,16 +81,23 @@ class AudioRouteUtils {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val currentCall = call ?: coreContext.core.currentCall ?: coreContext.core.calls[0]
|
val currentCall = call ?: coreContext.core.currentCall ?: coreContext.core.calls[0]
|
||||||
|
val conference = coreContext.core.conference
|
||||||
|
|
||||||
for (audioDevice in coreContext.core.audioDevices) {
|
for (audioDevice in coreContext.core.audioDevices) {
|
||||||
if (audioDevice.type == AudioDevice.Type.Bluetooth) {
|
if (audioDevice.type == AudioDevice.Type.Bluetooth) {
|
||||||
if (audioDevice.hasCapability(AudioDevice.Capabilities.CapabilityPlay)) {
|
if (audioDevice.hasCapability(AudioDevice.Capabilities.CapabilityPlay)) {
|
||||||
Log.i("[Audio Route Helper] Found bluetooth audio device [${audioDevice.deviceName}], routing audio to it")
|
if (conference != null && conference.isIn) {
|
||||||
|
Log.i("[Audio Route Helper] Found bluetooth audio device [${audioDevice.deviceName}], routing audio of conference to it")
|
||||||
|
conference.outputAudioDevice = audioDevice
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
Log.i("[Audio Route Helper] Found bluetooth audio device [${audioDevice.deviceName}], routing audio of call to it")
|
||||||
currentCall.outputAudioDevice = audioDevice
|
currentCall.outputAudioDevice = audioDevice
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Log.e("[Audio Route Helper] Couldn't find bluetooth audio device")
|
Log.e("[Audio Route Helper] Couldn't find bluetooth audio device")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,16 +107,23 @@ class AudioRouteUtils {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val currentCall = call ?: coreContext.core.currentCall ?: coreContext.core.calls[0]
|
val currentCall = call ?: coreContext.core.currentCall ?: coreContext.core.calls[0]
|
||||||
|
val conference = coreContext.core.conference
|
||||||
|
|
||||||
for (audioDevice in coreContext.core.audioDevices) {
|
for (audioDevice in coreContext.core.audioDevices) {
|
||||||
if (audioDevice.type == AudioDevice.Type.Headphones || audioDevice.type == AudioDevice.Type.Headset) {
|
if (audioDevice.type == AudioDevice.Type.Headphones || audioDevice.type == AudioDevice.Type.Headset) {
|
||||||
if (audioDevice.hasCapability(AudioDevice.Capabilities.CapabilityPlay)) {
|
if (audioDevice.hasCapability(AudioDevice.Capabilities.CapabilityPlay)) {
|
||||||
Log.i("[Audio Route Helper] Found headset audio device [${audioDevice.deviceName}], routing audio to it")
|
if (conference != null && conference.isIn) {
|
||||||
|
Log.i("[Audio Route Helper] Found headset audio device [${audioDevice.deviceName}], routing audio of conference to it")
|
||||||
|
conference.outputAudioDevice = audioDevice
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
Log.i("[Audio Route Helper] Found headset audio device [${audioDevice.deviceName}], routing audio of call to it")
|
||||||
currentCall.outputAudioDevice = audioDevice
|
currentCall.outputAudioDevice = audioDevice
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Log.e("[Audio Route Helper] Couldn't find headset audio device")
|
Log.e("[Audio Route Helper] Couldn't find headset audio device")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,8 +133,9 @@ class AudioRouteUtils {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
val currentCall = call ?: coreContext.core.currentCall ?: coreContext.core.calls[0]
|
val currentCall = call ?: coreContext.core.currentCall ?: coreContext.core.calls[0]
|
||||||
|
val conference = coreContext.core.conference
|
||||||
|
|
||||||
val audioDevice = currentCall.outputAudioDevice
|
val audioDevice = if (conference != null && conference.isIn) conference.outputAudioDevice else currentCall.outputAudioDevice
|
||||||
Log.i("[Audio Route Helper] Audio device currently in use is [${audioDevice?.deviceName}] with type (${audioDevice?.type})")
|
Log.i("[Audio Route Helper] Audio device currently in use is [${audioDevice?.deviceName}] with type (${audioDevice?.type})")
|
||||||
return audioDevice?.type == AudioDevice.Type.Speaker
|
return audioDevice?.type == AudioDevice.Type.Speaker
|
||||||
}
|
}
|
||||||
|
@ -116,8 +146,9 @@ class AudioRouteUtils {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
val currentCall = call ?: coreContext.core.currentCall ?: coreContext.core.calls[0]
|
val currentCall = call ?: coreContext.core.currentCall ?: coreContext.core.calls[0]
|
||||||
|
val conference = coreContext.core.conference
|
||||||
|
|
||||||
val audioDevice = currentCall.outputAudioDevice
|
val audioDevice = if (conference != null && conference.isIn) conference.outputAudioDevice else currentCall.outputAudioDevice
|
||||||
Log.i("[Audio Route Helper] Audio device currently in use is [${audioDevice?.deviceName}] with type (${audioDevice?.type})")
|
Log.i("[Audio Route Helper] Audio device currently in use is [${audioDevice?.deviceName}] with type (${audioDevice?.type})")
|
||||||
return audioDevice?.type == AudioDevice.Type.Bluetooth
|
return audioDevice?.type == AudioDevice.Type.Bluetooth
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue