问题描述
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.activities.room.RoomActivity">
<FrameLayout
android:id="@+id/primaryFrame"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@color/colorPrimary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/primaryPeerCircleText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="UU"
android:textAllCaps="true"
android:textSize="28sp"
android:padding="16dp"
android:textColor="@color/colorWhite"
android:background="@drawable/circle_white"
android:layout_gravity="center"/>
<org.webrtc.SurfaceVieWrenderer
android:id="@+id/primaryParticipantView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
<TextView
android:id="@+id/primaryParticipantText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:background="@drawable/primary_background"
android:padding="4dp"
android:text=""
android:textColor="@color/colorWhite"
android:visibility="gone" />
<include
layout="@layout/local_peer_video"
android:layout_width="120dp"
android:layout_height="180dp"
android:layout_gravity="top|right"/>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom">
<horizontalscrollview
android:id="@+id/horizontalContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/controlsLayout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<LinearLayout
android:id="@+id/participantsContainer"
android:layout_width="wrap_content"
android:layout_height="180dp"
android:orientation="horizontal" />
</horizontalscrollview>
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
primaryParticipantView
是全屏参与者的视频视图。
local_peer_video
是右上角的我自己的视频视图。当视频开始时,我在 local_peer_video 后面有 primaryParticipantView。当远程参与者禁用视频时,我隐藏了 primaryParticipantView 以使用 primaryPeerCircleText
显示他的名字。这可以正常工作。
val remoteParticipant = session.getRemoteParticipant(params.getString("connectionId"))
runOnUiThread {
if (params.getString("property") == "videoActive")
remoteParticipant?.videoView?.visibility = if (params.getString("newValue") == "true") View.VISIBLE else View.GONE
}
但是,当远程参与者再次启用视频时,会运行相同的代码片段并将 primaryParticipantView 的可见性设置为 VISIBLE。问题是,现在 primaryParticipantView
高于 local_peer_video,所以我看不到我自己。为什么会发生这种情况?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)