【发布时间】:2021-02-05 10:10:49
【问题描述】:
我的要求是使用表面视图显示视频聊天。我的视频视图也将包含远程视图和本地视图。
我可以对本地表面视图的形状进行四舍五入,但是当远程视频视图膨胀时,本地表面视图会恢复为原始矩形形状。
我正在使用轮廓提供和启用剪裁来制作圆形表面视图。
这是我想要实现的快照。 Local video surface view on top of other remote video surface view
这就是我得到的:-
在远程视图被视频放大之前: I can get curve shape of local view
在远程视图被视频充气后: again local view came back to original shape i.e rectangular
这是我的 xml 代码:-
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_video_chat_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="io.agora.tutorials1v1vcall.VideoChatViewActivity">
<RelativeLayout
android:id="@+id/remote_video_view_container"
android:layout_width="200dp"
android:layout_height="200dp"
android:background="@color/remoteBackground">
</RelativeLayout>
<RelativeLayout
android:id="@+id/local_frame"
android:layout_width="@dimen/local_preview_width"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/remote_video_view_container">
<FrameLayout
android:id="@+id/local_video_view_container"
android:layout_width="@dimen/local_preview_width"
android:layout_height="@dimen/local_preview_height"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="@dimen/local_preview_margin_right"
android:layout_marginRight="@dimen/local_preview_margin_right"
android:background="@color/localBackground"
android:elevation="10dp">
</FrameLayout>
</RelativeLayout>
这里远程表面视图将进入@+id/remote_video_view_container
局部表面视图将进入@+id/local_video_view_container 内,形状为圆形。
如需更多参考,我已将此示例用于 1 对 1 视频聊天。sample video chat
注意:- 我无法创建自定义表面视图作为我从 3rd 方库动态获取的表面视图实例。
任何帮助将不胜感激......
【问题讨论】:
标签: android video-streaming surfaceview agora.io