Added recv only video while in conference + fixed chat message file download progress text color in dark mode
This commit is contained in:
parent
a35b5d4c02
commit
492a23b61e
7 changed files with 55 additions and 15 deletions
|
@ -96,7 +96,8 @@ class ConferenceWaitingRoomViewModel : ViewModel() {
|
|||
updateMicState()
|
||||
|
||||
isVideoAvailable.value = core.isVideoCaptureEnabled || core.isVideoPreviewEnabled
|
||||
callParams.isVideoEnabled = core.videoActivationPolicy.automaticallyInitiate
|
||||
callParams.isVideoEnabled = isVideoAvailable.value == true
|
||||
callParams.videoDirection = if (core.videoActivationPolicy.automaticallyInitiate) MediaDirection.SendRecv else MediaDirection.RecvOnly
|
||||
Log.i("[Conference Waiting Room] Video will be ${if (callParams.isVideoEnabled) "enabled" else "disabled"}")
|
||||
updateVideoState()
|
||||
|
||||
|
@ -192,14 +193,14 @@ class ConferenceWaitingRoomViewModel : ViewModel() {
|
|||
askPermissionEvent.value = Event(Manifest.permission.CAMERA)
|
||||
return
|
||||
}
|
||||
callParams.isVideoEnabled = !callParams.isVideoEnabled
|
||||
callParams.videoDirection = if (callParams.videoDirection == MediaDirection.SendRecv) MediaDirection.RecvOnly else MediaDirection.SendRecv
|
||||
Log.i("[Conference Waiting Room] Video will be ${if (callParams.isVideoEnabled) "enabled" else "disabled"}")
|
||||
updateVideoState()
|
||||
}
|
||||
|
||||
fun enableVideo() {
|
||||
Log.i("[Conference Waiting Room] Video will be enabled")
|
||||
callParams.isVideoEnabled = true
|
||||
callParams.videoDirection = MediaDirection.SendRecv
|
||||
updateVideoState()
|
||||
}
|
||||
|
||||
|
@ -247,7 +248,7 @@ class ConferenceWaitingRoomViewModel : ViewModel() {
|
|||
}
|
||||
|
||||
private fun updateVideoState() {
|
||||
isVideoEnabled.value = callParams.isVideoEnabled
|
||||
isVideoEnabled.value = callParams.videoDirection == MediaDirection.SendRecv
|
||||
isSwitchCameraAvailable.value = callParams.isVideoEnabled && coreContext.showSwitchCameraButton()
|
||||
coreContext.core.isVideoPreviewEnabled = callParams.isVideoEnabled
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.linphone.activities.voip.data
|
|||
|
||||
import android.graphics.SurfaceTexture
|
||||
import android.view.TextureView
|
||||
import androidx.lifecycle.MediatorLiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||
import org.linphone.contact.GenericContactData
|
||||
|
@ -35,7 +36,11 @@ class ConferenceParticipantDeviceData(
|
|||
val isMe: Boolean
|
||||
) :
|
||||
GenericContactData(participantDevice.address) {
|
||||
val videoEnabled = MutableLiveData<Boolean>()
|
||||
val videoEnabled: MediatorLiveData<Boolean> = MediatorLiveData()
|
||||
|
||||
val videoAvailable = MutableLiveData<Boolean>()
|
||||
|
||||
val videoSendReceive = MutableLiveData<Boolean>()
|
||||
|
||||
val activeSpeaker = MutableLiveData<Boolean>()
|
||||
|
||||
|
@ -73,6 +78,7 @@ class ConferenceParticipantDeviceData(
|
|||
) {
|
||||
if (streamType == StreamType.Video) {
|
||||
Log.i("[Conference Participant Device] Participant [${participantDevice.address.asStringUriOnly()}] video capability changed to $direction")
|
||||
videoSendReceive.value = direction == MediaDirection.SendRecv
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,7 +89,7 @@ class ConferenceParticipantDeviceData(
|
|||
) {
|
||||
if (streamType == StreamType.Video) {
|
||||
Log.i("[Conference Participant Device] Participant [${participantDevice.address.asStringUriOnly()}] video availability changed to ${if (available) "available" else "unavailable"}")
|
||||
videoEnabled.value = available
|
||||
videoAvailable.value = available
|
||||
if (available) {
|
||||
updateWindowId(textureView)
|
||||
}
|
||||
|
@ -96,12 +102,21 @@ class ConferenceParticipantDeviceData(
|
|||
participantDevice.addListener(listener)
|
||||
|
||||
activeSpeaker.value = false
|
||||
videoEnabled.value = participantDevice.getStreamAvailability(StreamType.Video)
|
||||
videoAvailable.value = participantDevice.getStreamAvailability(StreamType.Video)
|
||||
val videoCapability = participantDevice.getStreamCapability(StreamType.Video)
|
||||
videoSendReceive.value = videoCapability == MediaDirection.SendRecv
|
||||
micMuted.value = false // TODO
|
||||
isInConference.value = participantDevice.isInConference
|
||||
|
||||
val videoCapability = participantDevice.getStreamCapability(StreamType.Video)
|
||||
Log.i("[Conference Participant Device] Participant [${participantDevice.address.asStringUriOnly()}], is in conf? ${isInConference.value}, is video enabled? ${videoEnabled.value} ($videoCapability)")
|
||||
videoEnabled.value = isVideoAvailableAndSendReceive()
|
||||
videoEnabled.addSource(videoAvailable) {
|
||||
videoEnabled.value = isVideoAvailableAndSendReceive()
|
||||
}
|
||||
videoEnabled.addSource(videoSendReceive) {
|
||||
videoEnabled.value = isVideoAvailableAndSendReceive()
|
||||
}
|
||||
|
||||
Log.i("[Conference Participant Device] Participant [${participantDevice.address.asStringUriOnly()}], is in conf? ${isInConference.value}, is video available? ${videoAvailable.value} ($videoCapability)")
|
||||
}
|
||||
|
||||
override fun destroy() {
|
||||
|
@ -161,4 +176,8 @@ class ConferenceParticipantDeviceData(
|
|||
participantDevice.nativeVideoWindowId = windowId
|
||||
}
|
||||
}
|
||||
|
||||
private fun isVideoAvailableAndSendReceive(): Boolean {
|
||||
return videoAvailable.value == true && videoSendReceive.value == true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,6 +54,8 @@ class ControlsViewModel : ViewModel() {
|
|||
|
||||
val isVideoEnabled = MutableLiveData<Boolean>()
|
||||
|
||||
val isVideoSendReceive = MutableLiveData<Boolean>()
|
||||
|
||||
val isVideoUpdateInProgress = MutableLiveData<Boolean>()
|
||||
|
||||
val isSwitchCameraAvailable = MutableLiveData<Boolean>()
|
||||
|
@ -316,7 +318,20 @@ class ControlsViewModel : ViewModel() {
|
|||
|
||||
isVideoUpdateInProgress.value = true
|
||||
val params = core.createCallParams(currentCall)
|
||||
params?.isVideoEnabled = !currentCall.currentParams.isVideoEnabled
|
||||
if (currentCall.conference != null) {
|
||||
if (params?.isVideoEnabled == false) {
|
||||
params.isVideoEnabled = true
|
||||
params.videoDirection = MediaDirection.SendRecv
|
||||
} else {
|
||||
if (params?.videoDirection == MediaDirection.SendRecv) {
|
||||
params.videoDirection = MediaDirection.RecvOnly
|
||||
} else {
|
||||
params?.videoDirection = MediaDirection.SendRecv
|
||||
}
|
||||
}
|
||||
} else {
|
||||
params?.isVideoEnabled = !currentCall.currentParams.isVideoEnabled
|
||||
}
|
||||
currentCall.update(params)
|
||||
}
|
||||
}
|
||||
|
@ -446,8 +461,14 @@ class ControlsViewModel : ViewModel() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
isVideoEnabled.value = enabled
|
||||
isSwitchCameraAvailable.value = enabled && coreContext.showSwitchCameraButton()
|
||||
if (coreContext.core.currentCall?.conference != null) {
|
||||
isVideoSendReceive.value = coreContext.core.currentCall?.currentParams?.videoDirection == MediaDirection.SendRecv
|
||||
} else {
|
||||
isVideoSendReceive.value = true
|
||||
}
|
||||
}
|
||||
|
||||
private fun shouldProximitySensorBeEnabled(): Boolean {
|
||||
|
|
|
@ -121,7 +121,6 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:textColor="?attr/secondaryTextColor"
|
||||
style="@style/file_transfer_progress_font"
|
||||
android:text="@{data.downloadProgressString, default=`50%`}"/>
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
<ImageView
|
||||
android:id="@+id/video"
|
||||
android:onClick="@{() -> controlsViewModel.toggleVideo()}"
|
||||
android:selected="@{controlsViewModel.isVideoEnabled}"
|
||||
android:selected="@{controlsViewModel.isVideoEnabled && controlsViewModel.isVideoSendReceive}"
|
||||
android:enabled="@{controlsViewModel.isVideoAvailable && !controlsViewModel.isVideoUpdateInProgress}"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="0dp"
|
||||
|
@ -102,7 +102,7 @@
|
|||
android:src="@drawable/icon_toggle_camera"
|
||||
android:padding="5dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:contentDescription="@{controlsViewModel.isVideoEnabled ? @string/content_description_disable_video : @string/content_description_enable_video}"
|
||||
android:contentDescription="@{controlsViewModel.isVideoEnabled && controlsViewModel.isVideoSendReceive ? @string/content_description_disable_video : @string/content_description_enable_video}"
|
||||
app:layout_constraintDimensionRatio="W,1:1"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/speaker"/>
|
||||
|
|
|
@ -145,7 +145,7 @@
|
|||
<org.linphone.activities.voip.views.RoundCornersTextureView
|
||||
android:id="@+id/remote_video_surface"
|
||||
android:onClick="@{() -> controlsViewModel.toggleFullScreen()}"
|
||||
android:visibility="@{controlsViewModel.isVideoEnabled && !viewModel.isRemotelyPaused ? View.VISIBLE : View.GONE, default=gone}"
|
||||
android:visibility="@{controlsViewModel.isVideoEnabled && controlsViewModel.isVideoSendReceive && !viewModel.isRemotelyPaused ? View.VISIBLE : View.GONE, default=gone}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
|
|
|
@ -440,7 +440,7 @@
|
|||
</style>
|
||||
|
||||
<style name="file_transfer_progress_font" parent="@android:style/TextAppearance.Medium">
|
||||
<item name="android:textColor">?attr/secondaryTextColor</item>
|
||||
<item name="android:textColor">?attr/primaryTextColor</item>
|
||||
<item name="android:textSize">12sp</item>
|
||||
</style>
|
||||
|
||||
|
|
Loading…
Reference in a new issue