mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-04-27 09:48:33 +00:00
Hide actively speaking participant miniature
This commit is contained in:
parent
ccd7bcea62
commit
d839aef96e
4 changed files with 20 additions and 3 deletions
|
|
@ -47,6 +47,8 @@ class ConferenceParticipantDeviceData(
|
||||||
|
|
||||||
val isJoining = MutableLiveData<Boolean>()
|
val isJoining = MutableLiveData<Boolean>()
|
||||||
|
|
||||||
|
val isActiveSpeaker = MutableLiveData<Boolean>()
|
||||||
|
|
||||||
private var textureView: TextureView? = null
|
private var textureView: TextureView? = null
|
||||||
|
|
||||||
private val listener = object : ParticipantDeviceListenerStub() {
|
private val listener = object : ParticipantDeviceListenerStub() {
|
||||||
|
|
@ -113,6 +115,7 @@ class ConferenceParticipantDeviceData(
|
||||||
participantDevice.addListener(listener)
|
participantDevice.addListener(listener)
|
||||||
|
|
||||||
isSpeaking.value = false
|
isSpeaking.value = false
|
||||||
|
isActiveSpeaker.value = false
|
||||||
isMuted.value = participantDevice.isMuted
|
isMuted.value = participantDevice.isMuted
|
||||||
|
|
||||||
videoAvailable.value = participantDevice.getStreamAvailability(StreamType.Video)
|
videoAvailable.value = participantDevice.getStreamAvailability(StreamType.Video)
|
||||||
|
|
|
||||||
|
|
@ -185,8 +185,11 @@ class ConferenceViewModel : ViewModel() {
|
||||||
val device = conferenceParticipantDevices.value.orEmpty().find {
|
val device = conferenceParticipantDevices.value.orEmpty().find {
|
||||||
it.participantDevice.address.weakEqual(participantDevice.address)
|
it.participantDevice.address.weakEqual(participantDevice.address)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device != null && device != speakingParticipant.value) {
|
if (device != null && device != speakingParticipant.value) {
|
||||||
Log.i("[Conference] Found actively speaking participant device")
|
Log.i("[Conference] Found actively speaking participant device")
|
||||||
|
speakingParticipant.value?.isActiveSpeaker?.value = false
|
||||||
|
device.isActiveSpeaker.value = true
|
||||||
speakingParticipant.value = device!!
|
speakingParticipant.value = device!!
|
||||||
} else if (device == null) {
|
} else if (device == null) {
|
||||||
Log.w("[Conference] Participant device [${participantDevice.address.asStringUriOnly()}] is the active speaker but couldn't find it in devices list")
|
Log.w("[Conference] Participant device [${participantDevice.address.asStringUriOnly()}] is the active speaker but couldn't find it in devices list")
|
||||||
|
|
@ -488,6 +491,7 @@ class ConferenceViewModel : ViewModel() {
|
||||||
if (activelySpeakingParticipantDevice == device) {
|
if (activelySpeakingParticipantDevice == device) {
|
||||||
Log.i("[Conference] Actively speaking participant device found: ${device.name} (${device.address.asStringUriOnly()})")
|
Log.i("[Conference] Actively speaking participant device found: ${device.name} (${device.address.asStringUriOnly()})")
|
||||||
speakingParticipant.value = deviceData
|
speakingParticipant.value = deviceData
|
||||||
|
deviceData.isActiveSpeaker.value = true
|
||||||
foundActivelySpeakingParticipantDevice = true
|
foundActivelySpeakingParticipantDevice = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -495,7 +499,9 @@ class ConferenceViewModel : ViewModel() {
|
||||||
|
|
||||||
if (!foundActivelySpeakingParticipantDevice && devices.isNotEmpty()) {
|
if (!foundActivelySpeakingParticipantDevice && devices.isNotEmpty()) {
|
||||||
Log.w("[Conference] Actively speaking participant device not found, using first participant device available")
|
Log.w("[Conference] Actively speaking participant device not found, using first participant device available")
|
||||||
speakingParticipant.value = devices.first()
|
val deviceData = devices.first()
|
||||||
|
speakingParticipant.value = deviceData
|
||||||
|
deviceData.isActiveSpeaker.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
for (device in conference.me.devices) {
|
for (device in conference.me.devices) {
|
||||||
|
|
@ -530,6 +536,7 @@ class ConferenceViewModel : ViewModel() {
|
||||||
|
|
||||||
if (speakingParticipant.value == null) {
|
if (speakingParticipant.value == null) {
|
||||||
speakingParticipant.value = deviceData
|
speakingParticipant.value = deviceData
|
||||||
|
deviceData.isActiveSpeaker.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
conferenceParticipantDevices.value = sortedDevices
|
conferenceParticipantDevices.value = sortedDevices
|
||||||
|
|
@ -561,7 +568,9 @@ class ConferenceViewModel : ViewModel() {
|
||||||
if (removedDeviceWasActiveSpeaker && devicesCount > 1) {
|
if (removedDeviceWasActiveSpeaker && devicesCount > 1) {
|
||||||
Log.w("[Conference] Updating actively speaking participant device using first one available")
|
Log.w("[Conference] Updating actively speaking participant device using first one available")
|
||||||
// Using second device as first is ourselves
|
// Using second device as first is ourselves
|
||||||
speakingParticipant.value = devices[1]
|
val deviceData = devices[1]
|
||||||
|
speakingParticipant.value = deviceData
|
||||||
|
deviceData.isActiveSpeaker.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
conferenceParticipantDevices.value = devices
|
conferenceParticipantDevices.value = devices
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,11 @@ import org.linphone.core.tools.Log
|
||||||
|
|
||||||
class GridBoxLayout : GridLayout {
|
class GridBoxLayout : GridLayout {
|
||||||
companion object {
|
companion object {
|
||||||
private val placementMatrix = arrayOf(intArrayOf(1, 2, 3, 4, 5, 6), intArrayOf(1, 1, 2, 2, 3, 3), intArrayOf(1, 1, 1, 2, 2, 2), intArrayOf(1, 1, 1, 1, 2, 2), intArrayOf(1, 1, 1, 1, 1, 2), intArrayOf(1, 1, 1, 1, 1, 1))
|
private val placementMatrix = arrayOf(
|
||||||
|
intArrayOf(1, 2, 3, 4, 5, 6), intArrayOf(1, 1, 2, 2, 3, 3),
|
||||||
|
intArrayOf(1, 1, 1, 2, 2, 2), intArrayOf(1, 1, 1, 1, 2, 2),
|
||||||
|
intArrayOf(1, 1, 1, 1, 1, 2), intArrayOf(1, 1, 1, 1, 1, 1)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(context: Context) : this(context, null)
|
constructor(context: Context) : this(context, null)
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
android:layout_height="@dimen/voip_active_speaker_miniature_size"
|
android:layout_height="@dimen/voip_active_speaker_miniature_size"
|
||||||
android:layout_margin="5dp"
|
android:layout_margin="5dp"
|
||||||
android:background="@{!data.isInConference && !data.isJoining ? @drawable/shape_remote_paused_background : @drawable/shape_remote_background, default=@drawable/shape_remote_background}"
|
android:background="@{!data.isInConference && !data.isJoining ? @drawable/shape_remote_paused_background : @drawable/shape_remote_background, default=@drawable/shape_remote_background}"
|
||||||
|
android:visibility="@{data.isActiveSpeaker ? View.GONE : View.VISIBLE}"
|
||||||
app:layout_alignSelf="flex_end"
|
app:layout_alignSelf="flex_end"
|
||||||
app:layout_flexShrink="0">
|
app:layout_flexShrink="0">
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue