@@ -367,6 +367,9 @@ LRESULT CAgoraMetaDataDlg::OnEIDLeaveChannel(WPARAM wParam, LPARAM lParam)
367367 m_joinChannel = false ;
368368 m_btnJoinChannel.SetWindowText (commonCtrlJoinChannel);
369369
370+ m_remoteVideoWnd.SetUID (0 );
371+ m_remoteVideoWnd.Invalidate ();
372+
370373 CString strInfo;
371374 strInfo.Format (_T (" leave channel success %s" ), getCurrentTime ());
372375 m_lstInfo.InsertString (m_lstInfo.GetCount (), strInfo);
@@ -383,7 +386,15 @@ LRESULT CAgoraMetaDataDlg::OnEIDUserJoined(WPARAM wParam, LPARAM lParam)
383386 strInfo.Format (_T (" %u joined" ), wParam);
384387 m_lstInfo.InsertString (m_lstInfo.GetCount (), strInfo);
385388
386-
389+ if (m_remoteVideoWnd.GetUID () == 0 ) {
390+ VideoCanvas canvas;
391+ canvas.uid = wParam;
392+ canvas.view = m_remoteVideoWnd.GetSafeHwnd ();
393+ canvas.renderMode = media::base::RENDER_MODE_FIT;
394+ // setup remote video in engine to the canvas.
395+ m_rtcEngine->setupRemoteVideo (canvas);
396+ m_remoteVideoWnd.SetUID (wParam);
397+ }
387398 return 0 ;
388399}
389400
@@ -396,6 +407,16 @@ LRESULT CAgoraMetaDataDlg::OnEIDUserOffline(WPARAM wParam, LPARAM lParam)
396407 strInfo.Format (_T (" %u offline, reason:%d" ), remoteUid, lParam);
397408 m_lstInfo.InsertString (m_lstInfo.GetCount (), strInfo);
398409
410+ VideoCanvas canvas;
411+ canvas.uid = remoteUid;
412+ canvas.view = NULL ;
413+ m_rtcEngine->setupRemoteVideo (canvas);
414+
415+ if (m_remoteVideoWnd.GetUID () == remoteUid) {
416+ m_remoteVideoWnd.SetUID (0 );
417+ m_remoteVideoWnd.Invalidate ();
418+ }
419+
399420 return 0 ;
400421}
401422
0 commit comments