Lock Meeting after 2 people Joined

Description
I would like to achieve Lock Meeting after 2 people Joined, which requires constantly checking for the new join. Is there any way to get a callback for a new person joined then I can proceed to lock the meeting.

Which version?
Newest

To Reproduce(If applicable)
Steps to reproduce the behavior:

Screenshots
If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Hey @aabudureheman

Thanks for using the dev forum!

Good question! The MobileRTCUserServiceDelegate provides a callback for when a user joins:

  • ( void )onSinkMeetingUserJoin:(NSUInteger)userID;

Objective-C:

- (void)onSinkMeetingUserJoin:(NSUInteger)userID
{
    MobileRTCMeetingService *ms = [[MobileRTC sharedRTC]getMeetingService];
    if (ms) {
        NSArray *users = [ms getInMeetingUserList];

        if (users.count == 2) {
            [ms lockMeeting:YES];
        }
    }
}

Swift:

func onSinkMeetingUserJoin(_ userID: UInt) {
    if let meetingService = MobileRTC.shared().getMeetingService() {
        let users = meetingService.getInMeetingUserList()

        if users?.count == 2 {
            meetingService.lockMeeting(true)
        }
    }
}

Let me know if that helps!
Michael