Skip to content

Commit d50595c

Browse files
author
xianing
committed
update multi-Channel best practice
1 parent 27cd586 commit d50595c

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

windows/APIExample/APIExample/Advanced/MultiChannel/CAgoraMultiChannelDlg.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,6 @@ bool CAgoraMultiChannelDlg::InitAgora()
9090
//set channel profile in the engine to the CHANNEL_PROFILE_LIVE_BROADCASTING.
9191
m_rtcEngine->setChannelProfile(CHANNEL_PROFILE_LIVE_BROADCASTING);
9292
m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("live broadcasting"));
93-
//set client role in the engine to the CLIENT_ROLE_BROADCASTER.
94-
m_rtcEngine->setClientRole(CLIENT_ROLE_BROADCASTER);
95-
m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("setClientRole broadcaster"));
9693
return true;
9794
}
9895

@@ -238,7 +235,12 @@ void CAgoraMultiChannelDlg::OnBnClickedButtonJoinchannel()
238235
options.autoSubscribeVideo = true;
239236
options.publishLocalAudio = m_chkPublishAudio.GetCheck();
240237
options.publishLocalVideo = m_chkPublishVideo.GetCheck();
241-
pChannel->setClientRole(CLIENT_ROLE_BROADCASTER);
238+
if (m_chkPublishAudio.GetCheck() || m_chkPublishVideo.GetCheck()) {
239+
pChannel->setClientRole(CLIENT_ROLE_BROADCASTER);
240+
}
241+
else {
242+
pChannel->setClientRole(CLIENT_ROLE_AUDIENCE);
243+
}
242244
//join channel
243245
if (0 == pChannel->joinChannel(APP_TOKEN, "", 0, options))
244246
{

0 commit comments

Comments
 (0)