From 31fb2421167c1e85ba2cbf93f7d329ac26b02efe Mon Sep 17 00:00:00 2001 From: imhao183 Date: Wed, 19 May 2021 10:39:47 +0800 Subject: [PATCH] =?UTF-8?q?=E7=82=B9=E5=87=BB=E5=B1=8F=E5=B9=95=E5=88=86?= =?UTF-8?q?=E4=BA=AB=E5=B0=8F=E7=AA=97=E5=8F=A3=E6=97=B6=E8=A6=81=E5=81=9C?= =?UTF-8?q?=E6=8E=89=E5=88=86=E4=BA=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chat/kit/voip/VoipCallService.java | 30 +++++++++++++++---- .../main/res-av/layout/av_voip_float_view.xml | 10 +++++++ 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/voip/VoipCallService.java b/uikit/src/main/java/cn/wildfire/chat/kit/voip/VoipCallService.java index e0003c9de..3bf822744 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/voip/VoipCallService.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/voip/VoipCallService.java @@ -125,7 +125,9 @@ private void checkCallState() { } else { updateNotification(session); if (showFloatingWindow && session.getState() == AVEngineKit.CallState.Connected) { - if (session.isAudioOnly()) { + if(session.isScreenSharing()) { + showScreenSharingView(session); + } else if (session.isAudioOnly()) { showAudioView(session); } else { showVideoView(session); @@ -222,7 +224,9 @@ private void showFloatingWindow(AVEngineKit.CallSession session) { if (session.getState() != AVEngineKit.CallState.Connected) { showUnConnectedCallInfo(session); } else { - if (session.isAudioOnly()) { + if(session.isScreenSharing()) { + showScreenSharingView(session); + } else if (session.isAudioOnly()) { showAudioView(session); } else { showVideoView(session); @@ -267,6 +271,18 @@ private void showUnConnectedCallInfo(AVEngineKit.CallSession session) { timeView.setText(title); } + private void showScreenSharingView(AVEngineKit.CallSession session) { + FrameLayout remoteVideoFrameLayout = view.findViewById(R.id.remoteVideoFrameLayout); + if (remoteVideoFrameLayout.getVisibility() == View.VISIBLE) { + remoteVideoFrameLayout.setVisibility(View.GONE); + wm.removeView(view); + wm.addView(view, params); + } + view.findViewById(R.id.screenSharingTextView).setVisibility(View.VISIBLE); + view.findViewById(R.id.durationTextView).setVisibility(View.GONE); + view.findViewById(R.id.av_media_type).setVisibility(View.GONE); + } + private void showAudioView(AVEngineKit.CallSession session) { FrameLayout remoteVideoFrameLayout = view.findViewById(R.id.remoteVideoFrameLayout); if (remoteVideoFrameLayout.getVisibility() == View.VISIBLE) { @@ -346,9 +362,13 @@ private void showVideoView(AVEngineKit.CallSession session) { } private void clickToResume() { - if (rendererInitialized) { - AVEngineKit.CallSession session = AVEngineKit.Instance().getCurrentSession(); - if (session != null) { + AVEngineKit.CallSession session = AVEngineKit.Instance().getCurrentSession(); + if (session != null) { + if(session.isScreenSharing()) { + session.stopScreenShare(); + } + + if (rendererInitialized) { session.resetRenderer(); } } diff --git a/uikit/src/main/res-av/layout/av_voip_float_view.xml b/uikit/src/main/res-av/layout/av_voip_float_view.xml index d280fbf0e..ee2b5ae03 100644 --- a/uikit/src/main/res-av/layout/av_voip_float_view.xml +++ b/uikit/src/main/res-av/layout/av_voip_float_view.xml @@ -20,6 +20,16 @@ android:layout_gravity="center" android:src="@drawable/av_float_audio" /> + +