From e3b419ff21fab5b7b4fcd6b77e75495bccc5698d Mon Sep 17 00:00:00 2001 From: saudsami Date: Fri, 5 Jul 2024 10:51:38 +0500 Subject: [PATCH] review updates --- .../web/_configuration-en.javascript.mdx | 2 +- .../project-implementation/windows.mdx | 183 ++++++++++++------ 2 files changed, 124 insertions(+), 61 deletions(-) diff --git a/shared/signaling/reference/api-ref/web/_configuration-en.javascript.mdx b/shared/signaling/reference/api-ref/web/_configuration-en.javascript.mdx index 8fc2b8792..348d3ceb0 100644 --- a/shared/signaling/reference/api-ref/web/_configuration-en.javascript.mdx +++ b/shared/signaling/reference/api-ref/web/_configuration-en.javascript.mdx @@ -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, diff --git a/shared/video-sdk/get-started/get-started-sdk/project-implementation/windows.mdx b/shared/video-sdk/get-started/get-started-sdk/project-implementation/windows.mdx index 533748f4d..84a26992e 100644 --- a/shared/video-sdk/get-started/get-started-sdk/project-implementation/windows.mdx +++ b/shared/video-sdk/get-started/get-started-sdk/project-implementation/windows.mdx @@ -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 @@ -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(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(m_hIcon); @@ -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); @@ -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(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(m_hIcon); @@ -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); @@ -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(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 @@ -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); @@ -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(); ``` @@ -1102,9 +1164,7 @@ Call the `joinChannel`[2/2] method, fill in the temporary token obtained from th ```cpp -void CAgoraQuickStartDlg::OnBnClickedBtnJoin() -{ - +void CAgoraQuickStartDlg::OnBnClickedBtnJoin() { CString strChannelName; // Get the channel name m_edtChannelName.GetWindowText(strChannelName); @@ -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); @@ -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); @@ -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); @@ -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); } @@ -1279,6 +1340,8 @@ When a user ends a call, closes the , or switches the