@@ -125,7 +125,9 @@ private void checkCallState() {
125125 } else {
126126 updateNotification (session );
127127 if (showFloatingWindow && session .getState () == AVEngineKit .CallState .Connected ) {
128- if (session .isAudioOnly ()) {
128+ if (session .isScreenSharing ()) {
129+ showScreenSharingView (session );
130+ } else if (session .isAudioOnly ()) {
129131 showAudioView (session );
130132 } else {
131133 showVideoView (session );
@@ -222,7 +224,9 @@ private void showFloatingWindow(AVEngineKit.CallSession session) {
222224 if (session .getState () != AVEngineKit .CallState .Connected ) {
223225 showUnConnectedCallInfo (session );
224226 } else {
225- if (session .isAudioOnly ()) {
227+ if (session .isScreenSharing ()) {
228+ showScreenSharingView (session );
229+ } else if (session .isAudioOnly ()) {
226230 showAudioView (session );
227231 } else {
228232 showVideoView (session );
@@ -267,6 +271,18 @@ private void showUnConnectedCallInfo(AVEngineKit.CallSession session) {
267271 timeView .setText (title );
268272 }
269273
274+ private void showScreenSharingView (AVEngineKit .CallSession session ) {
275+ FrameLayout remoteVideoFrameLayout = view .findViewById (R .id .remoteVideoFrameLayout );
276+ if (remoteVideoFrameLayout .getVisibility () == View .VISIBLE ) {
277+ remoteVideoFrameLayout .setVisibility (View .GONE );
278+ wm .removeView (view );
279+ wm .addView (view , params );
280+ }
281+ view .findViewById (R .id .screenSharingTextView ).setVisibility (View .VISIBLE );
282+ view .findViewById (R .id .durationTextView ).setVisibility (View .GONE );
283+ view .findViewById (R .id .av_media_type ).setVisibility (View .GONE );
284+ }
285+
270286 private void showAudioView (AVEngineKit .CallSession session ) {
271287 FrameLayout remoteVideoFrameLayout = view .findViewById (R .id .remoteVideoFrameLayout );
272288 if (remoteVideoFrameLayout .getVisibility () == View .VISIBLE ) {
@@ -346,9 +362,13 @@ private void showVideoView(AVEngineKit.CallSession session) {
346362 }
347363
348364 private void clickToResume () {
349- if (rendererInitialized ) {
350- AVEngineKit .CallSession session = AVEngineKit .Instance ().getCurrentSession ();
351- if (session != null ) {
365+ AVEngineKit .CallSession session = AVEngineKit .Instance ().getCurrentSession ();
366+ if (session != null ) {
367+ if (session .isScreenSharing ()) {
368+ session .stopScreenShare ();
369+ }
370+
371+ if (rendererInitialized ) {
352372 session .resetRenderer ();
353373 }
354374 }
0 commit comments