【问题标题】:Surface View in round shape on top of other surface view其他表面视图之上的圆形表面视图
【发布时间】: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


    【解决方案1】:

    您应该能够使用 AgoraTextureView 远程和 SurfaceView 本地实现这一点。我为展示这一点而构建的示例项目:https://slack-files.com/T1CBEDLJY-F012R1T5CL8-7425620f71

    【讨论】:

      猜你喜欢
      • 2016-08-02
      • 2014-07-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多