前言
前一段时间做了一个即时通讯的项目,在项目中遇到很多坑,有时间一一做个总结,项目消息发送基于XMPP+Tigase,语言视频通话基于PJSIP+FreeSWITCH,项目UI仿微信。做到视频通话时,遇到本地视图与远程视图切换,网上搜了一篇相关的博客:https://blog.csdn.net/xuedaqian123/article/details/77878781,根据大神思路写了这个Demo,其中用的是第三直播源可能有点不稳定,切换过程可能存在黑屏和无响应的情况,但是用的Pjsip中切换还是很流程的;
布局
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.demo.surfaceviewdemo.MainActivity">
android:layout_width="match_parent"
android:layout_height="match_parent">
android:id="@+id/rl_remote"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:id="@+id/surfaceview_remote"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:id="@