only show avatars for voiceonly calls

improve pip handling a bit

minor changes

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2025-05-07 13:10:50 +02:00
parent 1136508ba2
commit 257dc2af54
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B
5 changed files with 49 additions and 27 deletions

View File

@ -940,6 +940,8 @@ class CallActivity : CallBaseActivity() {
} }
private fun initSelfVideoViewForPipMode() { private fun initSelfVideoViewForPipMode() {
if (!isVoiceOnlyCall) {
binding!!.pipSelfVideoRenderer.visibility = View.VISIBLE
try { try {
binding!!.pipSelfVideoRenderer.init(rootEglBase!!.eglBaseContext, null) binding!!.pipSelfVideoRenderer.init(rootEglBase!!.eglBaseContext, null)
} catch (e: IllegalStateException) { } catch (e: IllegalStateException) {
@ -950,7 +952,10 @@ class CallActivity : CallBaseActivity() {
binding!!.pipSelfVideoRenderer.setEnableHardwareScaler(false) binding!!.pipSelfVideoRenderer.setEnableHardwareScaler(false)
binding!!.pipSelfVideoRenderer.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT) binding!!.pipSelfVideoRenderer.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT)
localVideoTrack!!.addSink(binding!!.pipSelfVideoRenderer) localVideoTrack?.addSink(binding?.pipSelfVideoRenderer)
} else {
binding!!.pipSelfVideoRenderer.visibility = View.GONE
}
} }
private fun initGrid() { private fun initGrid() {
@ -2187,6 +2192,7 @@ class CallActivity : CallBaseActivity() {
startVideoCapture(true) startVideoCapture(true)
} }
} }
in ANGLE_LANDSCAPE_RIGHT_THRESHOLD_MIN..ANGLE_LANDSCAPE_RIGHT_THRESHOLD_MAX, in ANGLE_LANDSCAPE_RIGHT_THRESHOLD_MIN..ANGLE_LANDSCAPE_RIGHT_THRESHOLD_MAX,
in ANGLE_LANDSCAPE_LEFT_THRESHOLD_MIN..ANGLE_LANDSCAPE_LEFT_THRESHOLD_MAX -> { in ANGLE_LANDSCAPE_LEFT_THRESHOLD_MIN..ANGLE_LANDSCAPE_LEFT_THRESHOLD_MAX -> {
if (lastAspectRatio != RATIO_16_TO_9) { if (lastAspectRatio != RATIO_16_TO_9) {
@ -2718,6 +2724,7 @@ class CallActivity : CallBaseActivity() {
handler!!.postDelayed({ setCallState(CallStatus.CALLING_TIMEOUT) }, CALLING_TIMEOUT) handler!!.postDelayed({ setCallState(CallStatus.CALLING_TIMEOUT) }, CALLING_TIMEOUT)
handler!!.post { handleCallStateJoined() } handler!!.post { handleCallStateJoined() }
} }
CallStatus.IN_CONVERSATION -> handler!!.post { handleCallStateInConversation() } CallStatus.IN_CONVERSATION -> handler!!.post { handleCallStateInConversation() }
CallStatus.OFFLINE -> handler!!.post { handleCallStateOffline() } CallStatus.OFFLINE -> handler!!.post { handleCallStateOffline() }
CallStatus.LEAVING -> handler!!.post { handleCallStateLeaving() } CallStatus.LEAVING -> handler!!.post { handleCallStateLeaving() }
@ -3241,21 +3248,30 @@ class CallActivity : CallBaseActivity() {
binding!!.callInfosLinearLayout.visibility = View.GONE binding!!.callInfosLinearLayout.visibility = View.GONE
binding!!.selfVideoViewWrapper.visibility = View.GONE binding!!.selfVideoViewWrapper.visibility = View.GONE
binding!!.callStates.callStateRelativeLayout.visibility = View.GONE binding!!.callStates.callStateRelativeLayout.visibility = View.GONE
binding!!.pipCallConversationNameTextView.text = conversationName
if (isVoiceOnlyCall) {
if (participantItems.size > 1) {
binding!!.pipOverlay.visibility = View.VISIBLE
binding!!.pipSelfVideoRenderer.visibility = View.GONE
} else {
binding!!.pipOverlay.visibility = View.GONE
}
} else {
binding!!.selfVideoRenderer.clearImage() binding!!.selfVideoRenderer.clearImage()
binding!!.selfVideoRenderer.release() binding!!.selfVideoRenderer.release()
if (participantItems.size > 1) { if (participantItems.size > 1) {
binding!!.pipCallConversationNameTextView.text = conversationName binding!!.pipOverlay.visibility = View.VISIBLE
binding!!.pipSelfVideoOverlay.visibility = View.VISIBLE
initSelfVideoViewForPipMode() initSelfVideoViewForPipMode()
} else { } else {
binding!!.pipSelfVideoOverlay.visibility = View.GONE binding!!.pipOverlay.visibility = View.GONE
}
} }
} }
override fun updateUiForNormalMode() { override fun updateUiForNormalMode() {
Log.d(TAG, "updateUiForNormalMode") Log.d(TAG, "updateUiForNormalMode")
binding!!.pipSelfVideoOverlay.visibility = View.GONE binding!!.pipOverlay.visibility = View.GONE
if (isVoiceOnlyCall) { if (isVoiceOnlyCall) {
binding!!.callControls.visibility = View.VISIBLE binding!!.callControls.visibility = View.VISIBLE

View File

@ -55,7 +55,7 @@ fun AvatarWithFallback(participant: ParticipantUiState, modifier: Modifier = Mod
contentAlignment = Alignment.Center contentAlignment = Alignment.Center
) { ) {
Text( Text(
text = if (initials.isNotEmpty()) initials else "?", text = initials.ifEmpty { "?" },
color = Color.Black, color = Color.Black,
fontSize = 24.sp fontSize = 24.sp
) )

View File

@ -94,7 +94,8 @@ fun ParticipantGrid(
modifier = Modifier modifier = Modifier
.height(itemHeight) .height(itemHeight)
.fillMaxWidth(), .fillMaxWidth(),
eglBase = eglBase eglBase = eglBase,
isVoiceOnlyCall = isVoiceOnlyCall
) )
} }
} }
@ -261,7 +262,7 @@ fun getTestParticipants(numberOfParticipants: Int): List<ParticipantUiState> {
sessionKey = i.toString(), sessionKey = i.toString(),
nick = "testuser$i Test", nick = "testuser$i Test",
isConnected = true, isConnected = true,
isAudioEnabled = if (i == 3) true else false, isAudioEnabled = true,
isStreamEnabled = true, isStreamEnabled = true,
raisedHand = true, raisedHand = true,
avatarUrl = "", avatarUrl = "",

View File

@ -33,13 +33,18 @@ import com.nextcloud.talk.call.ParticipantUiState
import org.webrtc.EglBase import org.webrtc.EglBase
@Composable @Composable
fun ParticipantTile(participant: ParticipantUiState, eglBase: EglBase?, modifier: Modifier = Modifier) { fun ParticipantTile(
participant: ParticipantUiState,
eglBase: EglBase?,
modifier: Modifier = Modifier,
isVoiceOnlyCall: Boolean,
) {
Box( Box(
modifier = modifier modifier = modifier
.clip(RoundedCornerShape(12.dp)) .clip(RoundedCornerShape(12.dp))
.background(Color.DarkGray) .background(Color.DarkGray)
) { ) {
if (participant.isStreamEnabled && participant.mediaStream != null) { if (!isVoiceOnlyCall && participant.isStreamEnabled && participant.mediaStream != null) {
WebRTCVideoView(participant, eglBase) WebRTCVideoView(participant, eglBase)
} else { } else {
AvatarWithFallback( AvatarWithFallback(
@ -113,6 +118,7 @@ fun ParticipantTilePreview() {
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.height(300.dp), .height(300.dp),
eglBase = null eglBase = null,
isVoiceOnlyCall = false
) )
} }

View File

@ -322,7 +322,7 @@
</LinearLayout> </LinearLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/pipSelfVideoOverlay" android:id="@+id/pipOverlay"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/black" android:background="@color/black"
@ -336,9 +336,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginStart="5dp" android:layout_marginStart="5dp"
android:layout_marginTop="40dp" android:layout_marginTop="0dp"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:layout_marginBottom="-30dp"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="3" android:maxLines="3"
android:textAlignment="center" android:textAlignment="center"