Description
Inside the callback onUserJoin (from IMeetingParticipantsCtrlEvent), pUserInfo->IsHost() returns false for all users, even the host itself.
Tried also to iterate over GetParticipantsList() (from IMeetingParticipantsController), got same result (all false).
Which Windows Meeting SDK version?
5.14.5.15340
To Reproduce(If applicable)
Steps to reproduce the behavior:
Have the SDK demo join any meeting.
Inside onUserJoin callback:
void CMeetingServiceMgr::onUserJoin(IList<unsigned int >* lstUserID, const wchar_t* strUserList)
{
// print user name
::log("INFO: MeetingServiceMgr::onUserJoin START ");
if (lstUserID && m_pMeetingService)
{
int count = lstUserID->GetCount();
for (int i = 0; i < count; i++)
{
int userId = lstUserID->GetItem(i);
IUserInfo* pUserInfo = this->GetUserByUserID(userId);
if (pUserInfo)
{
using convert_type = codecvt_utf8<wchar_t>;
wstring_convert<convert_type, wchar_t> converter;
auto uname = (wstring)pUserInfo->GetUserNameW();
string str_uname = converter.to_bytes(uname);
::log("user info:");
::log(to_string(userId) + " " + str_uname);
::log("isHost:");
::log(std::to_string(pUserInfo->IsHost()));
}
}
}
auto pUsers = m_pUserCtrl->GetParticipantsList();
if (!pUsers)
{
::log("Could not GetParticipantsList. Cannot get user id.");
}
for (auto i = 0; i < pUsers->GetCount(); i++)
{
auto user_id = pUsers->GetItem(i);
auto pUser = this->GetUserByUserID(user_id);
string current_user_name = WCharToString(pUser->GetUserNameW());
::log("pUser->GetUserNameW():");
::log(current_user_name);
::log("isHost:");
::log(std::to_string(pUser->IsHost()));
}
}
I have updated the SDK in our solution, currently using latest: 5.16.0.22251.
I have done the same as you - tried with an if else clause. However, I am experiencing the same results. Always false. I will link code and logs below.
Question -
Have you run those lines of code inside the onUserJoin callback?
Because everywhere else (any other callback afterwards) it works, I have tested this in other callbacks.
But it is crucial that I can determine who the host is inside the onUserJoin specifically.
Code:
void CMeetingServiceMgr::onUserJoin(IList<unsigned int >* lstUserID, const wchar_t* strUserList)
{
::log("INFO: CMeetingServiceMgr::onUserJoin START ");
if (lstUserID && m_pMeetingService)
{
int count = lstUserID->GetCount();
for (int i = 0; i < count; i++)
{
int userId = lstUserID->GetItem(i);
IUserInfo* pUserInfo = this->GetUserByUserID(userId);
if (pUserInfo)
{
using convert_type = codecvt_utf8<wchar_t>;
wstring_convert<convert_type, wchar_t> converter;
auto uname = (wstring)pUserInfo->GetUserNameW();
string str_uname = converter.to_bytes(uname);
::log("user info:");
::log(to_string(userId) + " " + str_uname);
::log("isHost:");
::log(std::to_string(pUserInfo->IsHost()));
if (pUserInfo->IsHost()) {
::log("isHost: TRUE");
}
else {
::log("isHost: FALSE");
}
}
}
}
auto pUsers = m_pUserCtrl->GetParticipantsList();
if (!pUsers)
{
::log("Could not GetParticipantsList. Cannot get user id.");
}
// Trying with iterating.
for (auto i = 0; i < pUsers->GetCount(); i++)
{
auto user_id = pUsers->GetItem(i);
auto pUser = this->GetUserByUserID(user_id);
string current_user_name = WCharToString(pUser->GetUserNameW());
::log("pUser->GetUserNameW():");
::log(current_user_name);
::log("isHost:");
::log(std::to_string(pUser->IsHost()));
if (pUser->IsHost()) {
::log("isHost: TRUE");
}
else {
::log("isHost: FALSE");
}
}
}