Inside onUserJoin, every user returns false when calling isHost(), even for the host itself

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:

  1. Have the SDK demo join any meeting.
  2. 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()));
	}
}

Logs

2023-09-21 15:08:29.360 3612909816Chorus911183868F47829455DAED58668858A7184 INFO: CMeetingServiceMgr::onUserJoin START 
2023-09-21 15:08:29.360 3612909816Chorus911183868F47829455DAED58668858A7184 user info:
2023-09-21 15:08:29.360 3612909816Chorus911183868F47829455DAED58668858A7184 16778240 Oren Nahum
2023-09-21 15:08:29.361 3612909816Chorus911183868F47829455DAED58668858A7184 isHost:
2023-09-21 15:08:29.361 3612909816Chorus911183868F47829455DAED58668858A7184 0
2023-09-21 15:08:45. 98 3612909816Chorus911183868F47829455DAED58668858A7184 pUser->GetUserNameW():
2023-09-21 15:08:45. 98 3612909816Chorus911183868F47829455DAED58668858A7184 Oren Nahum
2023-09-21 15:08:45. 98 3612909816Chorus911183868F47829455DAED58668858A7184 isHost:
2023-09-21 15:08:45. 99 3612909816Chorus911183868F47829455DAED58668858A7184 0
2023-09-21 15:08:45. 99 3612909816Chorus911183868F47829455DAED58668858A7184 pUser->GetUserNameW():
2023-09-21 15:08:45. 99 3612909816Chorus911183868F47829455DAED58668858A7184 ZoomSDKDemo
2023-09-21 15:08:45. 99 3612909816Chorus911183868F47829455DAED58668858A7184 isHost:
2023-09-21 15:08:45. 99 3612909816Chorus911183868F47829455DAED58668858A7184 0

Device (please complete the following information):

  • Device: HP Zenbook
  • OS: Windows 10

Additional context
I need to know when the host joins so I can prompt him with RequestLocalRecordingPrivilege (from IMeetingRecordingController).

@Oren ,

I’m using the latest SDK, but I’m unable to replicate the issue.
Could you try with an if else for IsHost() ?

IList<unsigned int>* meetingParticipantID = meetingService->GetMeetingParticipantsController()->GetParticipantsList();

if (meetingParticipantID && meetingService)
{
	int count = meetingParticipantID->GetCount();
	for (int i = 0; i < count; i++)
	{
		int userId = meetingParticipantID->GetItem(i);
		IUserInfo* pUserInfo = meetingService->GetMeetingParticipantsController()->GetUserByUserID(userId);
		if (pUserInfo)
		{

			
			printf("UserID %d\n", pUserInfo->GetUserID());
			printf("UserName %ls\n", pUserInfo->GetUserNameA());
			if (pUserInfo->IsHost()) {
			printf("Is Host: true\n");
			}
			else {
				printf("Is Host: false\n");
			}


		}


	}
}

image

1 Like

Hi @chunsiong.zoom , Thanks for your reply!

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");
		}
	}
}

Logs:

2023-09-26 08:25:05.366 3612909816Chorus911183868F47829455DAED58668858A7184 INFO: CMeetingServiceMgr::onUserJoin START 
2023-09-26 08:25:05.367 3612909816Chorus911183868F47829455DAED58668858A7184 user info:
2023-09-26 08:25:05.367 3612909816Chorus911183868F47829455DAED58668858A7184 16779264 Chorus911
2023-09-26 08:25:05.368 3612909816Chorus911183868F47829455DAED58668858A7184 isHost:
2023-09-26 08:25:05.368 3612909816Chorus911183868F47829455DAED58668858A7184 0
2023-09-26 08:25:05.369 3612909816Chorus911183868F47829455DAED58668858A7184 isHost: FALSE
2023-09-26 08:25:05.369 3612909816Chorus911183868F47829455DAED58668858A7184 pUser->GetUserNameW():
2023-09-26 08:25:05.370 3612909816Chorus911183868F47829455DAED58668858A7184 Oren Nahum
2023-09-26 08:25:05.371 3612909816Chorus911183868F47829455DAED58668858A7184 isHost:
2023-09-26 08:25:05.371 3612909816Chorus911183868F47829455DAED58668858A7184 0
2023-09-26 08:25:05.372 3612909816Chorus911183868F47829455DAED58668858A7184 isHost: FALSE
2023-09-26 08:25:05.372 3612909816Chorus911183868F47829455DAED58668858A7184 pUser->GetUserNameW():
2023-09-26 08:25:05.372 3612909816Chorus911183868F47829455DAED58668858A7184 Chorus911
2023-09-26 08:25:05.372 3612909816Chorus911183868F47829455DAED58668858A7184 isHost:
2023-09-26 08:25:05.373 3612909816Chorus911183868F47829455DAED58668858A7184 0
2023-09-26 08:25:05.374 3612909816Chorus911183868F47829455DAED58668858A7184 isHost: FALSE

@oren.nahum1 ,

as requested. This is slightly harder to test as

  1. the host needs to leave and rejoin (without assigning the host to someone else when leaving) or
  2. the SDK needs to join before the host

image

1 Like

Thanks @chunsiong.zoom , that worked.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.