From e3bbe3503f908e1d00146c78c1cb4d31837b7b6e Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Tue, 29 Apr 2025 18:50:35 +0200 Subject: [PATCH 1/3] show own video in pip mode for group calls Signed-off-by: Marcel Hibbe --- .../nextcloud/talk/activities/CallActivity.kt | 34 ++++++++++++++----- app/src/main/res/layout/call_activity.xml | 28 ++++----------- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt index 8b7460725..d62a24060 100644 --- a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt @@ -901,7 +901,7 @@ class CallActivity : CallBaseActivity() { if (cameraEnumerator!!.deviceNames.size < 2) { binding!!.switchSelfVideoButton.visibility = View.GONE } - initSelfVideoView() + initSelfVideoViewForNormalMode() } binding!!.gridview.setOnTouchListener { _, me -> val action = me.actionMasked @@ -924,7 +924,7 @@ class CallActivity : CallBaseActivity() { } @SuppressLint("ClickableViewAccessibility") - private fun initSelfVideoView() { + private fun initSelfVideoViewForNormalMode() { try { binding!!.selfVideoRenderer.init(rootEglBase!!.eglBaseContext, null) } catch (e: IllegalStateException) { @@ -937,6 +937,20 @@ class CallActivity : CallBaseActivity() { binding!!.selfVideoRenderer.setOnTouchListener(SelfVideoTouchListener()) } + private fun initSelfVideoViewForPipMode() { + try { + binding!!.pipSelfVideoRenderer.init(rootEglBase!!.eglBaseContext, null) + } catch (e: IllegalStateException) { + Log.d(TAG, "pipGroupVideoRenderer already initialized", e) + } + binding!!.pipSelfVideoRenderer.setZOrderMediaOverlay(true) + // disabled because it causes some devices to crash + binding!!.pipSelfVideoRenderer.setEnableHardwareScaler(false) + binding!!.pipSelfVideoRenderer.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT) + + localVideoTrack!!.addSink(binding!!.pipSelfVideoRenderer) + } + private fun initGridAdapter() { Log.d(TAG, "initGridAdapter") val columns: Int @@ -3211,17 +3225,20 @@ class CallActivity : CallBaseActivity() { binding!!.callInfosLinearLayout.visibility = View.GONE binding!!.selfVideoViewWrapper.visibility = View.GONE binding!!.callStates.callStateRelativeLayout.visibility = View.GONE - if (participantDisplayItems!!.size > 1) { - binding!!.pipCallConversationNameTextView.text = conversationName - binding!!.pipGroupCallOverlay.visibility = View.VISIBLE - } else { - binding!!.pipGroupCallOverlay.visibility = View.GONE - } + binding!!.selfVideoRenderer.release() + if (participantDisplayItems!!.size > 1) { + binding!!.pipSelfVideoOverlay.visibility = View.VISIBLE + initSelfVideoViewForPipMode() + } else { + binding!!.pipSelfVideoOverlay.visibility = View.GONE + } } override fun updateUiForNormalMode() { Log.d(TAG, "updateUiForNormalMode") + binding!!.pipSelfVideoOverlay.visibility = View.GONE + if (isVoiceOnlyCall) { binding!!.callControls.visibility = View.VISIBLE } else { @@ -3231,7 +3248,6 @@ class CallActivity : CallBaseActivity() { initViews() binding!!.callInfosLinearLayout.visibility = View.VISIBLE binding!!.selfVideoViewWrapper.visibility = View.VISIBLE - binding!!.pipGroupCallOverlay.visibility = View.GONE } override fun suppressFitsSystemWindows() { diff --git a/app/src/main/res/layout/call_activity.xml b/app/src/main/res/layout/call_activity.xml index 4c256eb09..3b8f54726 100644 --- a/app/src/main/res/layout/call_activity.xml +++ b/app/src/main/res/layout/call_activity.xml @@ -331,7 +331,7 @@ - - - - + android:layout_height="match_parent" + android:layout_gravity="center" + android:clickable="false" + tools:visibility="visible" /> From ee6543d76644e21dd03875dd8de4f26433fafea5 Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Tue, 29 Apr 2025 19:01:37 +0200 Subject: [PATCH 2/3] fix to release "self" renderers when camera switched off Signed-off-by: Marcel Hibbe --- .../main/java/com/nextcloud/talk/activities/CallActivity.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt index d62a24060..50721c8c9 100644 --- a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt @@ -1369,6 +1369,11 @@ class CallActivity : CallBaseActivity() { binding!!.selfVideoRenderer.visibility = View.VISIBLE } else { binding!!.selfVideoRenderer.visibility = View.INVISIBLE + binding!!.selfVideoRenderer.clearImage() + binding!!.selfVideoRenderer.release() + + binding!!.pipSelfVideoRenderer.clearImage() + binding!!.pipSelfVideoRenderer.release() } } else { if (enable) { From 0d2014aa2774669df5765cb4eb75e07889072bf8 Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Tue, 29 Apr 2025 19:41:46 +0200 Subject: [PATCH 3/3] set icon with call name as fallback for pip group calls when own video is disabled Signed-off-by: Marcel Hibbe --- .../nextcloud/talk/activities/CallActivity.kt | 6 ++++ app/src/main/res/layout/call_activity.xml | 36 ++++++++++++++----- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt index 50721c8c9..b787b7afe 100644 --- a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt @@ -1367,8 +1367,13 @@ class CallActivity : CallBaseActivity() { } if (enable) { binding!!.selfVideoRenderer.visibility = View.VISIBLE + binding!!.pipSelfVideoRenderer.visibility = View.VISIBLE + + initSelfVideoViewForNormalMode() } else { binding!!.selfVideoRenderer.visibility = View.INVISIBLE + binding!!.pipSelfVideoRenderer.visibility = View.INVISIBLE + binding!!.selfVideoRenderer.clearImage() binding!!.selfVideoRenderer.release() @@ -3233,6 +3238,7 @@ class CallActivity : CallBaseActivity() { binding!!.selfVideoRenderer.release() if (participantDisplayItems!!.size > 1) { + binding!!.pipCallConversationNameTextView.text = conversationName binding!!.pipSelfVideoOverlay.visibility = View.VISIBLE initSelfVideoViewForPipMode() } else { diff --git a/app/src/main/res/layout/call_activity.xml b/app/src/main/res/layout/call_activity.xml index 3b8f54726..df7bca34f 100644 --- a/app/src/main/res/layout/call_activity.xml +++ b/app/src/main/res/layout/call_activity.xml @@ -182,9 +182,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginStart="50dp" - android:layout_marginBottom="50dp"> - - + android:layout_marginBottom="50dp"/> - - - + + + + - + tools:visibility="gone" /> + +