Skip to content

Commit 5bd8efb

Browse files
committed
fix: fix region remote canvas
1 parent 423b14a commit 5bd8efb

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

windows/APIExample/APIExample/Advanced/RegionConn/CAgoraRegionConnDlg.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ LRESULT CAgoraRegionConnDlg::OnEIDUserJoined(WPARAM wParam, LPARAM lParam)
6060
CString strInfo;
6161
strInfo.Format(_T("%u joined"), wParam);
6262
m_lstInfo.InsertString(m_lstInfo.GetCount(), strInfo);
63+
VideoCanvas canvas;
64+
canvas.uid = wParam;
65+
canvas.view = m_remoteVideoWnd.GetSafeHwnd();
66+
canvas.renderMode = media::base::RENDER_MODE_FIT;
67+
//setup remote video in engine to the canvas.
68+
m_rtcEngine->setupRemoteVideo(canvas);
69+
m_remoteVideoWnd.SetUID(wParam);
6370
return TRUE;
6471
}
6572

@@ -220,9 +227,17 @@ BOOL CAgoraRegionConnDlg::OnInitDialog()
220227
m_localVideoWnd.Create(NULL, NULL, WS_CHILD | WS_VISIBLE | WS_BORDER | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, CRect(0, 0, 1, 1), this, ID_BASEWND_VIDEO + 100);
221228
RECT rcArea;
222229
m_staVideoArea.GetClientRect(&rcArea);
230+
rcArea.right = rcArea.left + (rcArea.right - rcArea.left) / 2;
223231
m_localVideoWnd.MoveWindow(&rcArea);
224232
m_localVideoWnd.ShowWindow(SW_SHOW);
225233

234+
m_remoteVideoWnd.Create(NULL, NULL, WS_CHILD | WS_VISIBLE | WS_BORDER | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, CRect(0, 0, 1, 1), this, ID_BASEWND_VIDEO + 100);
235+
RECT rcArea2;
236+
m_staVideoArea.GetClientRect(&rcArea2);
237+
rcArea2.left = rcArea2.left + (rcArea2.right - rcArea2.left) / 2;
238+
m_remoteVideoWnd.MoveWindow(&rcArea2);
239+
m_remoteVideoWnd.ShowWindow(SW_SHOW);
240+
226241
int nIndex = 0;
227242

228243
m_cmbAreaCode.InsertString(nIndex++, _T("AREA_CODE_GLOBAL"));

windows/APIExample/APIExample/Advanced/RegionConn/CAgoraRegionConnDlg.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ class CAgoraRegionConnDlg : public CDialogEx
114114
bool m_initialize = false;
115115
IRtcEngine* m_rtcEngine = nullptr;
116116
CAGVideoWnd m_localVideoWnd;
117+
CAGVideoWnd m_remoteVideoWnd;
117118
CAgoraRegionConnHandler m_eventHandler;
118119
std::map<CString,AREA_CODE> m_mapAreaCode;
119120
protected:

0 commit comments

Comments
 (0)