Skip to content

Commit 05f73a5

Browse files
committed
jira: NMS-6012 NMS-6014
1 parent f0b4513 commit 05f73a5

5 files changed

Lines changed: 31 additions & 10 deletions

File tree

windows/APIExample/APIExample/APIExample.vcxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<ProjectGuid>{DB16CA2F-3910-4449-A5BD-6A602B33BE0F}</ProjectGuid>
2424
<Keyword>MFCProj</Keyword>
2525
<RootNamespace>APIExample</RootNamespace>
26-
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
26+
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
2727
</PropertyGroup>
2828
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
2929
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@@ -44,7 +44,7 @@
4444
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
4545
<ConfigurationType>Application</ConfigurationType>
4646
<UseDebugLibraries>true</UseDebugLibraries>
47-
<PlatformToolset>v141</PlatformToolset>
47+
<PlatformToolset>v142</PlatformToolset>
4848
<CharacterSet>Unicode</CharacterSet>
4949
<UseOfMfc>Dynamic</UseOfMfc>
5050
</PropertyGroup>

windows/APIExample/APIExample/Advanced/ReportInCall/CAgoraReportInCallDlg.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ class CAgoraReportInCallHandler : public IRtcEngineEventHandler
212212
*
213213
* @param stats Statistics of the local video stream. See LocalVideoStats.
214214
*/
215-
virtual void onLocalVideoStats(const LocalVideoStats& stats) override {
215+
virtual void onLocalVideoStats(VIDEO_SOURCE_TYPE source, const LocalVideoStats& stats) override {
216216
if (m_hMsgHanlder)
217217
::PostMessage(m_hMsgHanlder, WM_MSGID(EID_LOCAL_VIDEO_STATS), (WPARAM)new LocalVideoStats(stats), 0);
218218
}
@@ -223,7 +223,7 @@ class CAgoraReportInCallHandler : public IRtcEngineEventHandler
223223
@param localVideoState State type #LOCAL_VIDEO_STREAM_STATE. When the state is LOCAL_VIDEO_STREAM_STATE_FAILED (3), see the `error` parameter for details.
224224
@param error The detailed error information: #LOCAL_VIDEO_STREAM_ERROR.
225225
*/
226-
virtual void onLocalVideoStateChanged(LOCAL_VIDEO_STREAM_STATE localVideoState, LOCAL_VIDEO_STREAM_ERROR error)override {
226+
virtual void onLocalVideoStateChanged(VIDEO_SOURCE_TYPE source, LOCAL_VIDEO_STREAM_STATE localVideoState, LOCAL_VIDEO_STREAM_ERROR error)override {
227227
(void)localVideoState;
228228
(void)error;
229229
}

windows/APIExample/APIExample/Advanced/SpatialAudio/CAgoraSpatialAudioDlg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ void CAgoraSpatialAudioDlg::OnBnClickedButtonStart()
373373
CString strInfo;
374374
strInfo.Format(_T("startEchoTest %d seconds"), 10);
375375
m_lstInfo.InsertString(m_lstInfo.GetCount(), strInfo);
376-
m_rtcEngine->startAudioMixing(cs2utf8(m_audioPath).c_str(), false, true, 1, 0);
376+
m_rtcEngine->startAudioMixing(cs2utf8(m_audioPath).c_str(), false, 1, 0);
377377
strInfo.Format(_T("startAudioMixing"));
378378
m_lstInfo.InsertString(m_lstInfo.GetCount(), strInfo);
379379

windows/APIExample/APIExample/Basic/LiveBroadcasting/CLiveBroadcastingDlg.cpp

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,6 @@ bool CLiveBroadcastingDlg::InitAgora()
297297
m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("enable video"));
298298

299299
m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("live broadcasting"));
300-
//set client role in the engine to the CLIENT_ROLE_BROADCASTER.
301-
m_rtcEngine->setClientRole(CLIENT_ROLE_BROADCASTER);
302-
m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("setClientRole broadcaster"));
303300
return true;
304301
}
305302

@@ -356,6 +353,20 @@ void CLiveBroadcastingDlg::RenderLocalVideo()
356353
}
357354
}
358355

356+
void CLiveBroadcastingDlg::StopLocalVideo()
357+
{
358+
if (m_rtcEngine) {
359+
//start preview in the engine.
360+
m_rtcEngine->stopPreview();
361+
VideoCanvas canvas;
362+
canvas.uid = 0;
363+
canvas.view = NULL;
364+
//setup local video in the engine to the canvas.
365+
m_rtcEngine->setupLocalVideo(canvas);
366+
m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("stop local video"));
367+
}
368+
}
369+
359370

360371
void CLiveBroadcastingDlg::OnSelchangeComboPersons()
361372
{
@@ -367,7 +378,15 @@ void CLiveBroadcastingDlg::OnSelchangeComboPersons()
367378
void CLiveBroadcastingDlg::OnSelchangeComboRole()
368379
{
369380
if (m_rtcEngine) {
370-
m_rtcEngine->setClientRole(CLIENT_ROLE_TYPE(m_cmbRole.GetCurSel() + 1));
381+
m_rtcEngine->setClientRole(m_cmbRole.GetCurSel() == 0 ? CLIENT_ROLE_BROADCASTER : CLIENT_ROLE_AUDIENCE);
382+
383+
if (m_cmbRole.GetCurSel() == 0) {
384+
// start video and render local video
385+
RenderLocalVideo();
386+
} else {
387+
// stop video and unbind local video
388+
StopLocalVideo();
389+
}
371390

372391
m_lstInfo.InsertString(m_lstInfo.GetCount(), m_cmbRole.GetCurSel() == 0 ? _T("setClientRole broadcaster"): _T("setClientRole Audience"));
373392
}
@@ -396,7 +415,7 @@ void CLiveBroadcastingDlg::OnBnClickedButtonJoinchannel()
396415

397416
ChannelMediaOptions options;
398417
options.channelProfile = CHANNEL_PROFILE_LIVE_BROADCASTING;
399-
options.clientRoleType = CLIENT_ROLE_BROADCASTER;
418+
options.clientRoleType = CLIENT_ROLE_TYPE(m_cmbRole.GetCurSel() + 1);
400419
options.autoSubscribeAudio = true;
401420
options.autoSubscribeVideo = true;
402421
//join channel in the engine.

windows/APIExample/APIExample/Basic/LiveBroadcasting/CLiveBroadcastingDlg.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ class CLiveBroadcastingDlg : public CDialogEx
236236
void ShowVideoWnds();
237237
//render local video from SDK local capture.
238238
void RenderLocalVideo();
239+
//stop local video capture from SDK
240+
void StopLocalVideo();
239241

240242

241243
IRtcEngine* m_rtcEngine = nullptr;

0 commit comments

Comments
 (0)