mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-12 07:14:05 +01:00
show own video in pip mode for group calls
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
947d064c34
commit
e3bbe3503f
@ -901,7 +901,7 @@ class CallActivity : CallBaseActivity() {
|
|||||||
if (cameraEnumerator!!.deviceNames.size < 2) {
|
if (cameraEnumerator!!.deviceNames.size < 2) {
|
||||||
binding!!.switchSelfVideoButton.visibility = View.GONE
|
binding!!.switchSelfVideoButton.visibility = View.GONE
|
||||||
}
|
}
|
||||||
initSelfVideoView()
|
initSelfVideoViewForNormalMode()
|
||||||
}
|
}
|
||||||
binding!!.gridview.setOnTouchListener { _, me ->
|
binding!!.gridview.setOnTouchListener { _, me ->
|
||||||
val action = me.actionMasked
|
val action = me.actionMasked
|
||||||
@ -924,7 +924,7 @@ class CallActivity : CallBaseActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
private fun initSelfVideoView() {
|
private fun initSelfVideoViewForNormalMode() {
|
||||||
try {
|
try {
|
||||||
binding!!.selfVideoRenderer.init(rootEglBase!!.eglBaseContext, null)
|
binding!!.selfVideoRenderer.init(rootEglBase!!.eglBaseContext, null)
|
||||||
} catch (e: IllegalStateException) {
|
} catch (e: IllegalStateException) {
|
||||||
@ -937,6 +937,20 @@ class CallActivity : CallBaseActivity() {
|
|||||||
binding!!.selfVideoRenderer.setOnTouchListener(SelfVideoTouchListener())
|
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() {
|
private fun initGridAdapter() {
|
||||||
Log.d(TAG, "initGridAdapter")
|
Log.d(TAG, "initGridAdapter")
|
||||||
val columns: Int
|
val columns: Int
|
||||||
@ -3211,17 +3225,20 @@ 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
|
||||||
if (participantDisplayItems!!.size > 1) {
|
|
||||||
binding!!.pipCallConversationNameTextView.text = conversationName
|
|
||||||
binding!!.pipGroupCallOverlay.visibility = View.VISIBLE
|
|
||||||
} else {
|
|
||||||
binding!!.pipGroupCallOverlay.visibility = View.GONE
|
|
||||||
}
|
|
||||||
binding!!.selfVideoRenderer.release()
|
binding!!.selfVideoRenderer.release()
|
||||||
|
if (participantDisplayItems!!.size > 1) {
|
||||||
|
binding!!.pipSelfVideoOverlay.visibility = View.VISIBLE
|
||||||
|
initSelfVideoViewForPipMode()
|
||||||
|
} else {
|
||||||
|
binding!!.pipSelfVideoOverlay.visibility = View.GONE
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun updateUiForNormalMode() {
|
override fun updateUiForNormalMode() {
|
||||||
Log.d(TAG, "updateUiForNormalMode")
|
Log.d(TAG, "updateUiForNormalMode")
|
||||||
|
binding!!.pipSelfVideoOverlay.visibility = View.GONE
|
||||||
|
|
||||||
if (isVoiceOnlyCall) {
|
if (isVoiceOnlyCall) {
|
||||||
binding!!.callControls.visibility = View.VISIBLE
|
binding!!.callControls.visibility = View.VISIBLE
|
||||||
} else {
|
} else {
|
||||||
@ -3231,7 +3248,6 @@ class CallActivity : CallBaseActivity() {
|
|||||||
initViews()
|
initViews()
|
||||||
binding!!.callInfosLinearLayout.visibility = View.VISIBLE
|
binding!!.callInfosLinearLayout.visibility = View.VISIBLE
|
||||||
binding!!.selfVideoViewWrapper.visibility = View.VISIBLE
|
binding!!.selfVideoViewWrapper.visibility = View.VISIBLE
|
||||||
binding!!.pipGroupCallOverlay.visibility = View.GONE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun suppressFitsSystemWindows() {
|
override fun suppressFitsSystemWindows() {
|
||||||
|
@ -331,7 +331,7 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/pipGroupCallOverlay"
|
android:id="@+id/pipSelfVideoOverlay"
|
||||||
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"
|
||||||
@ -339,27 +339,13 @@
|
|||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:visibility="gone">
|
android:visibility="gone">
|
||||||
|
|
||||||
<TextView
|
<org.webrtc.SurfaceViewRenderer
|
||||||
android:id="@+id/pipCallConversationNameTextView"
|
android:id="@+id/pipSelfVideoRenderer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginStart="5dp"
|
android:layout_gravity="center"
|
||||||
android:layout_marginTop="-30dp"
|
android:clickable="false"
|
||||||
android:layout_marginEnd="5dp"
|
tools:visibility="visible" />
|
||||||
android:layout_marginBottom="15dp"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:maxLines="3"
|
|
||||||
android:textAlignment="center"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="16sp"
|
|
||||||
tools:text="our group call" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="80dp"
|
|
||||||
android:layout_height="80dp"
|
|
||||||
app:srcCompat="@drawable/ic_circular_group"
|
|
||||||
tools:ignore="ContentDescription" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
Loading…
Reference in New Issue
Block a user