@@ -144,6 +144,7 @@ void CAgoraMediaEncryptDlg::ResumeStatus()
144
144
m_lstInfo.ResetContent ();
145
145
m_edtEncryptKey.SetWindowText (_T (" " ));
146
146
m_staDetails.SetWindowText (_T (" " ));
147
+ m_btnSetEncrypt.EnableWindow (TRUE );
147
148
m_joinChannel = false ;
148
149
m_initialize = false ;
149
150
m_setEncrypt = false ;
@@ -156,10 +157,18 @@ BOOL CAgoraMediaEncryptDlg::OnInitDialog()
156
157
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 );
157
158
RECT rcArea;
158
159
m_staVideoArea.GetClientRect (&rcArea);
160
+ int halfWidth = (rcArea.right - rcArea.left ) / 2 ;
161
+ rcArea.right = rcArea.left + halfWidth;
159
162
m_localVideoWnd.MoveWindow (&rcArea);
160
163
m_localVideoWnd.ShowWindow (SW_SHOW);
161
- int nIndex = 0 ;
164
+ m_remoteVideoWnd.Create (NULL , NULL , WS_CHILD | WS_VISIBLE | WS_BORDER | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, CRect (0 , 0 , 1 , 1 ), this , ID_BASEWND_VIDEO + 101 );
165
+ rcArea.left = rcArea.right ;
166
+ rcArea.right = rcArea.left + halfWidth;
167
+ m_remoteVideoWnd.MoveWindow (&rcArea);
168
+ m_remoteVideoWnd.ShowWindow (SW_SHOW);
169
+ m_remoteVideoWnd.SetUID (0 );
162
170
171
+ int nIndex = 0 ;
163
172
// m_cmbEncryptMode.InsertString(nIndex++, _T("aes-128-xts"));
164
173
// m_cmbEncryptMode.InsertString(nIndex++, _T("aes-128-ecb"));
165
174
// m_cmbEncryptMode.InsertString(nIndex++, _T("aes-256-xts"));
@@ -278,6 +287,7 @@ LRESULT CAgoraMediaEncryptDlg::OnEIDJoinChannelSuccess(WPARAM wParam, LPARAM lPa
278
287
strInfo.Format (_T (" %s:join success, uid=%u" ), getCurrentTime (), wParam);
279
288
m_lstInfo.InsertString (m_lstInfo.GetCount (), strInfo);
280
289
m_localVideoWnd.SetUID (wParam);
290
+ m_btnSetEncrypt.EnableWindow (FALSE );
281
291
// notify parent window
282
292
::PostMessage (GetParent()->GetSafeHwnd(), WM_MSGID(EID_JOINCHANNEL_SUCCESS), TRUE, 0);
283
293
return 0 ;
@@ -293,6 +303,7 @@ LRESULT CAgoraMediaEncryptDlg::OnEIDLeaveChannel(WPARAM wParam, LPARAM lParam)
293
303
CString strInfo;
294
304
strInfo.Format (_T (" leave channel success %s" ), getCurrentTime ());
295
305
m_lstInfo.InsertString (m_lstInfo.GetCount (), strInfo);
306
+ m_btnSetEncrypt.EnableWindow (TRUE );
296
307
::PostMessage (GetParent()->GetSafeHwnd(), WM_MSGID(EID_JOINCHANNEL_SUCCESS), FALSE, 0);
297
308
return 0 ;
298
309
}
@@ -301,8 +312,19 @@ LRESULT CAgoraMediaEncryptDlg::OnEIDLeaveChannel(WPARAM wParam, LPARAM lParam)
301
312
LRESULT CAgoraMediaEncryptDlg::OnEIDUserJoined (WPARAM wParam, LPARAM lParam)
302
313
{
303
314
CString strInfo;
304
- strInfo.Format (_T (" %u joined" ), wParam);
315
+ uid_t remoteUid = wParam;
316
+ strInfo.Format (_T (" %u joined" ), remoteUid);
305
317
m_lstInfo.InsertString (m_lstInfo.GetCount (), strInfo);
318
+
319
+ if (m_remoteVideoWnd.GetUID () == 0 ) {
320
+ m_remoteVideoWnd.SetUID (remoteUid);
321
+
322
+ VideoCanvas canvas;
323
+ canvas.view = m_remoteVideoWnd.GetSafeHwnd ();
324
+ canvas.renderMode = agora::media::base::RENDER_MODE_HIDDEN;
325
+ canvas.uid = remoteUid;
326
+ m_rtcEngine->setupRemoteVideo (canvas);
327
+ }
306
328
return 0 ;
307
329
}
308
330
@@ -316,6 +338,16 @@ LRESULT CAgoraMediaEncryptDlg::OnEIDUserOffline(WPARAM wParam, LPARAM lParam)
316
338
strInfo.Format (_T (" %u offline, reason:%d" ), remoteUid, lParam);
317
339
m_lstInfo.InsertString (m_lstInfo.GetCount (), strInfo);
318
340
341
+ if (m_remoteVideoWnd.GetUID () == remoteUid) {
342
+ m_remoteVideoWnd.SetUID (0 );
343
+ m_remoteVideoWnd.Reset ();
344
+
345
+ VideoCanvas canvas;
346
+ canvas.view = nullptr ;
347
+ canvas.uid = remoteUid;
348
+ m_rtcEngine->setupRemoteVideo (canvas);
349
+ }
350
+
319
351
return 0 ;
320
352
}
321
353
0 commit comments