Skip to content

Commit

Permalink
review updates
Browse files Browse the repository at this point in the history
  • Loading branch information
saudsami committed Jul 5, 2024
1 parent a6a16c6 commit e3b419f
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const { RTM, EncryptionMode } = AgoraRTM;
const rtmConfig = {
token : "yourToken",
encryptionMode : EncryptionMode.AES_256_GCM,
slat : yourSalt,
salt : yourSalt,
cipherKey : "yourCipherKey",
presenceTimeout : 300,
logUpload : true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,19 +270,19 @@ void CAgoraQuickStartDlg::OnBnClickedBtnJoin() {
AfxMessageBox(_T("Fill channel name first"));
return;
}
ChannelMediaOptions option;
ChannelMediaOptions options;
// Set channel profile to live broadcasting
option.channelProfile = CHANNEL_PROFILE_COMMUNICATION;
options.channelProfile = CHANNEL_PROFILE_COMMUNICATION;
// Set user role to broadcaster
option.clientRoleType = CLIENT_ROLE_BROADCASTER;
options.clientRoleType = CLIENT_ROLE_BROADCASTER;
// Automatically subscribe to audio streams in the channel
option.autoSubscribeAudio = true;
options.autoSubscribeAudio = true;
// Automatically subscribe to video streams in the channel
option.autoSubscribeVideo = true;
options.autoSubscribeVideo = true;
// Publish the microphone track
option.publishMicrophoneTrack = true;
options.publishMicrophoneTrack = true;
// Publish the camera track
option.publishCameraTrack = true;
options.publishCameraTrack = true;
// Join the channel with the temporary token obtained from the Agora Console
int ret = m_rtcEngine->joinChannel(token, cs2utf8(strChannelName).c_str(), 0, option);
// Render local view
Expand Down Expand Up @@ -461,7 +461,27 @@ void CAgoraQuickStartDlg::OnSysCommand(UINT nID, LPARAM lParam) {
CDialog::OnSysCommand(nID, lParam);
}
}
// If the dialog box has a minimize button, the framework should draw the icon
// If you add a minimize button to the dialog box, you need the following code
// to draw the icon. For MFC applications using the document/view model, this is done automatically by the framework
void CAgoraQuickStartDlg::OnPaint() {
if (IsIconic()) {
CPaintDC dc(this);
// Device context for drawing
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()),0);
// Center the icon in the client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
} else {
CDialog::OnPaint();
}
}
// This function is called by the framework to obtain the cursor when the user drags the minimized window
HCURSOR CAgoraQuickStartDlg::OnQueryDragIcon() {
return static_cast<HCURSOR>(m_hIcon);
Expand All @@ -480,18 +500,19 @@ void CAgoraQuickStartDlg::OnBnClickedBtnJoin() {
AfxMessageBox(_T("Fill channel name first"));
return;
}
ChannelMediaOptions option;
ChannelMediaOptions options;
// Set channel profile to live broadcasting
option.channelProfile = CHANNEL_PROFILE_LIVE_BROADCASTING;
options.channelProfile = CHANNEL_PROFILE_LIVE_BROADCASTING;
// Set user role to broadcaster; keep default value if setting user role to audience
option.clientRoleType = CLIENT_ROLE_BROADCASTER;
options.clientRoleType = CLIENT_ROLE_BROADCASTER;
// Automatically subscribe to all audio streams
option.autoSubscribeAudio = true;
options.autoSubscribeAudio = true;
// Automatically subscribe to all video streams
option.autoSubscribeVideo = true;
options.autoSubscribeVideo = true;
// Specify the audio latency level
option.audienceLatencyLevel = AUDIENCE_LATENCY_LEVEL_LOW_LATENCY;
options.audienceLatencyLevel = AUDIENCE_LATENCY_LEVEL_LOW_LATENCY;
// Join the channel with the temporary token obtained from the Agora Console
int ret = m_rtcEngine->joinChannel(token, cs2utf8(strChannelName).c_str(), 0, option);
Expand Down Expand Up @@ -671,7 +692,27 @@ void CAgoraQuickStartDlg::OnSysCommand(UINT nID, LPARAM lParam) {
CDialog::OnSysCommand(nID, lParam);
}
}
// If the dialog box has a minimize button, the framework should draw the icon
// If you add a minimize button to the dialog box, you need the following code
// to draw the icon. For MFC applications using the document/view model, this is done automatically by the framework
void CAgoraQuickStartDlg::OnPaint() {
if (IsIconic()) {
CPaintDC dc(this);
// Device context for drawing
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()),0);
// Center the icon in the client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
} else {
CDialog::OnPaint();
}
}
// This function is called by the framework to obtain the cursor when the user drags the minimized window
HCURSOR CAgoraQuickStartDlg::OnQueryDragIcon() {
return static_cast<HCURSOR>(m_hIcon);
Expand All @@ -690,18 +731,18 @@ void CAgoraQuickStartDlg::OnBnClickedBtnJoin() {
AfxMessageBox(_T("Fill channel name first"));
return;
}
ChannelMediaOptions option;
ChannelMediaOptions options;
// Set channel profile to live broadcasting
option.channelProfile = CHANNEL_PROFILE_LIVE_BROADCASTING;
options.channelProfile = CHANNEL_PROFILE_LIVE_BROADCASTING;
// Set user role to broadcaster; keep default value if setting user role to audience
option.clientRoleType = CLIENT_ROLE_BROADCASTER;
options.clientRoleType = CLIENT_ROLE_BROADCASTER;
// Automatically subscribe to all audio streams
option.autoSubscribeAudio = true;
options.autoSubscribeAudio = true;
// Automatically subscribe to all video streams
option.autoSubscribeVideo = true;
options.autoSubscribeVideo = true;
// Specify the audio latency level
option.audienceLatencyLevel = AUDIENCE_LATENCY_LEVEL_ULTRA_LOW_LATENCY;
options.audienceLatencyLevel = AUDIENCE_LATENCY_LEVEL_ULTRA_LOW_LATENCY;
// Join the channel with the temporary token obtained from the Agora Console
int ret = m_rtcEngine->joinChannel(token, cs2utf8(strChannelName).c_str(), 0, option);
Expand Down Expand Up @@ -905,12 +946,31 @@ void CAgoraQuickStartDlg::OnSysCommand(UINT nID, LPARAM lParam)
}
}
// If you add a minimize button to your dialog, you will need the code below
// If you add a minimize button to the dialog box, you need the following code
// to draw the icon. For MFC applications using the document/view model, this is done automatically by the framework
void CAgoraQuickStartDlg::OnPaint() {
if (IsIconic()) {
CPaintDC dc(this);
// Device context for drawing
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()),0);
// Center the icon in the client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
} else {
CDialog::OnPaint();
}
}
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CAgoraQuickStartDlg::OnPaint()
{
void CAgoraQuickStartDlg::OnPaint() {
if (IsIconic())
{
CPaintDC dc(this); // Device context for painting
Expand Down Expand Up @@ -960,15 +1020,15 @@ void CAgoraQuickStartDlg::OnBnClickedBtnJoin()
return;
}
ChannelMediaOptions option;
ChannelMediaOptions options;
// Set channel profile to live broadcasting
option.channelProfile = CHANNEL_PROFILE_LIVE_BROADCASTING;
options.channelProfile = CHANNEL_PROFILE_LIVE_BROADCASTING;
// Set user role to broadcaster
option.clientRoleType = CLIENT_ROLE_BROADCASTER;
options.clientRoleType = CLIENT_ROLE_BROADCASTER;
// Auto subscribe to all audio streams in the channel
option.autoSubscribeAudio = true;
options.autoSubscribeAudio = true;
// Publish the microphone track
option.publishMicrophoneTrack = true;
options.publishMicrophoneTrack = true;
// Fill in your temporary Token from the console to join the channel
m_rtcEngine->joinChannel(token, cs2utf8(strChannelName).c_str(), 0, option);
Expand Down Expand Up @@ -1092,6 +1152,8 @@ canvas.uid = 0;
// Video display window
canvas.view = m_staLocal.GetSafeHwnd();
m_rtcEngine->setupLocalVideo(canvas);
// Preview the local video
m_rtcEngine->startPreview();
```
</ProductWrapper>
Expand All @@ -1102,9 +1164,7 @@ Call the `joinChannel`[2/2] method, fill in the temporary token obtained from th
<ProductWrapper product="video-calling">
```cpp
void CAgoraQuickStartDlg::OnBnClickedBtnJoin()
{
void CAgoraQuickStartDlg::OnBnClickedBtnJoin() {
CString strChannelName;
// Get the channel name
m_edtChannelName.GetWindowText(strChannelName);
Expand All @@ -1113,19 +1173,20 @@ void CAgoraQuickStartDlg::OnBnClickedBtnJoin()
return;
}
ChannelMediaOptions option;
ChannelMediaOptions options;
// Set the channel profile to live broadcasting
option.channelProfile = CHANNEL_PROFILE_LIVE_BROADCASTING;
options.channelProfile = CHANNEL_PROFILE_LIVE_BROADCASTING;
// Set the user role to broadcaster; to set the user role as audience, keep the default value
option.clientRoleType = CLIENT_ROLE_BROADCASTER;
options.clientRoleType = CLIENT_ROLE_BROADCASTER;
// Publish the audio stream captured by the microphone
option.publishMicrophoneTrack = true;
options.publishMicrophoneTrack = true;
// Automatically subscribe to all audio streams
// Publish the microphone track
option.publishMicrophoneTrack = true;
options.publishMicrophoneTrack = true;
// Publish the camera track
option.publishCameraTrack = true;
option.autoSubscribeAudio = true;
options.publishCameraTrack = true;
options.autoSubscribeAudio = true;
options.autoSubscribeVideo = true;
// Join the channel using the temporary token obtained from the console
m_rtcEngine->joinChannel(token, cs2utf8(strChannelName).c_str(), 0, option);
Expand All @@ -1152,22 +1213,22 @@ void CAgoraQuickStartDlg::OnBnClickedBtnJoin() {
return;
}

ChannelMediaOptions option;
ChannelMediaOptions options;
// Set channel profile to live broadcasting
option.channelProfile = CHANNEL_PROFILE_LIVE_BROADCASTING;
options.channelProfile = CHANNEL_PROFILE_LIVE_BROADCASTING;
// Set user role to broadcaster; keep default value if setting user role to audience
option.clientRoleType = CLIENT_ROLE_BROADCASTER;
options.clientRoleType = CLIENT_ROLE_BROADCASTER;
// Publish the local video track
option.publishMicrophoneTrack = true;
options.publishMicrophoneTrack = true;
// Publish the camera track
option.publishCameraTrack = true;
options.publishCameraTrack = true;
// Automatically subscribe to all audio streams
option.autoSubscribeAudio = true;
options.autoSubscribeAudio = true;
// Automatically subscribe to all video streams
option.autoSubscribeVideo = true;
options.autoSubscribeVideo = true;

// Specify the audio latency level
option.audienceLatencyLevel = AUDIENCE_LATENCY_LEVEL_LOW_LATENCY;
options.audienceLatencyLevel = AUDIENCE_LATENCY_LEVEL_LOW_LATENCY;

// Fill in your temporary token obtained from the Agora Console to join the channel
m_rtcEngine->joinChannel(token, cs2utf8(strChannelName).c_str(), 0, option);
Expand All @@ -1194,22 +1255,22 @@ void CAgoraQuickStartDlg::OnBnClickedBtnJoin() {
return;
}

ChannelMediaOptions option;
ChannelMediaOptions options;
// Set channel profile to live broadcasting
option.channelProfile = CHANNEL_PROFILE_LIVE_BROADCASTING;
options.channelProfile = CHANNEL_PROFILE_LIVE_BROADCASTING;
// Set user role to broadcaster; keep default value if setting user role to audience
option.clientRoleType = CLIENT_ROLE_BROADCASTER;
options.clientRoleType = CLIENT_ROLE_BROADCASTER;
// Publish the microphone track
option.publishMicrophoneTrack = true;
options.publishMicrophoneTrack = true;
// Publish the camera track
option.publishCameraTrack = true;
options.publishCameraTrack = true;
// Automatically subscribe to all audio streams
option.autoSubscribeAudio = true;
options.autoSubscribeAudio = true;
// Automatically subscribe to all video streams
option.autoSubscribeVideo = true;
options.autoSubscribeVideo = true;

// Specify the audio latency level
option.audienceLatencyLevel = AUDIENCE_LATENCY_LEVEL_ULTRA_LOW_LATENCY;
options.audienceLatencyLevel = AUDIENCE_LATENCY_LEVEL_ULTRA_LOW_LATENCY;

// Fill in your temporary token obtained from the Agora Console to join the channel
m_rtcEngine->joinChannel(token, cs2utf8(strChannelName).c_str(), 0, option);
Expand All @@ -1230,15 +1291,15 @@ void CAgoraQuickStartDlg::OnBnClickedBtnJoin()
return;
}

ChannelMediaOptions option;
ChannelMediaOptions options;
// Set the channel profile to live broadcasting
option.channelProfile = CHANNEL_PROFILE_LIVE_BROADCASTING;
options.channelProfile = CHANNEL_PROFILE_LIVE_BROADCASTING;
// Set the user role as broadcaster; keep the default value if you want to set the user role as audience
option.clientRoleType = CLIENT_ROLE_BROADCASTER;
options.clientRoleType = CLIENT_ROLE_BROADCASTER;
// Publish the microphone track
option.publishMicrophoneTrack = true;
options.publishMicrophoneTrack = true;
// Automatically subscribe to all audio streams
option.autoSubscribeAudio = true;
options.autoSubscribeAudio = true;
// Fill in the temporary token you obtained from the console to join the channel
m_rtcEngine->joinChannel(token, cs2utf8(strChannelName).c_str(), 0, option);
}
Expand Down Expand Up @@ -1279,6 +1340,8 @@ When a user ends a call, closes the <Vpl k="CLIENT"/>, or switches the <Vpl k="C
```cpp
void CAgoraQuickStartDlg::OnBnClickedBtnLeave() {
// Stop local video preview
m_rtcEngine->stopPreview();
// Leave the channel
m_rtcEngine->leaveChannel();
Expand Down

0 comments on commit e3b419f

Please sign in to comment.