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" /> + +