# Use meeting statuses The Meeting SDK for iOS provides rich listeners for you to monitor and perform actions when some behaviors happen. ## Meeting service status ### Meeting state Once the meeting has started or joined, our SDK will return the meeting state using **MeetingServiceDelegate**. If you would like to listen to the meeting service, you can implement the following methods: ```objectivec - (void)onMeetingReturn:( MobileRTCMeetError)error internalError:(NSInteger)internalError { NSLog(@"onMeetingReturn:%d, internalError:%zd", error, internalError); } - (void)onMeetingStateChange:(MobileRTCMeetingState)state { if (self.mainVC) { [self.mainVC onMeetingStateChange:state]; } } - (void)onMeetingError:(MobileRTCMeetError)error message:(NSString*)message { NSLog(@"onMeetingError:%zd, message:%@", error, message); } - (void)onMeetingReady { if (self.mainVC) { [self.mainVC onMeetingReady]; } } #if 0 - (void)onMeetingEndedReason:(MobileRTCMeetingEndReason)reason { NSLog(@"onMeetingEndedReason %d", reason); } #endif #pragma mark - ZAK expired #if 0 - (void)onZoomIdentityExpired { NSLog(@"onZoomIdentityExpired"); } ``` ### Join a meeting You can implement `onJoinMeetingConfirmed` method to catch the moment when you successfully join a meeting, you can also get the join meeting info by implementing the `onJoinMeetingInfo` method: ```objectivec - (void)onJoinMeetingConfirmed { NSString *meetingNo = [[MobileRTCInviteHelper sharedInstance] ongoingMeetingNumber]; NSLog(@"onJoinMeetingConfirmed MeetingNo: %@", meetingNo); } - (void)onJoinMeetingInfo:(MobileRTCJoinMeetingInfo)info completion:(void (^)(NSString *displayName, NSString *password, BOOL cancel))completion { if (self.mainVC) { [self.mainVC onJoinMeetingInfo:info completion:(void (^)(NSString *displayName, NSString *password, BOOL cancel))completion]; } } ``` ### Waiting room Implement `onWaitingRoomStatusChange` method to catch status changes in the waiting room. ```objectivec - (void)onWaitingRoomStatusChange:(BOOL)needWaiting { if (self.customMeetingVC) { [self.customMeetingVC onWaitingRoomStatusChange:needWaiting]; } } ``` ### Webinar Implement the following methods to monitor changes during a webinar. ```objectivec - (void)onSinkWebinarNeedRegister:(NSString *)registerURL { NSLog(@"%@",registerURL); } - (void)onSinkJoinWebinarNeedUserNameAndEmailWithCompletion:(BOOL (^_Nonnull)(NSString * _Nonnull username, NSString * _Nonnull email, BOOL cancel))completion { if (completion) { NSString * username = [NSString stringWithString:@"example"]; NSString * email = [NSString stringWithString:@"example@example.com"]; BOOL ret = completion(username,email,NO); NSLog(@"%zd",ret); } } ``` ### Buttons These methods are associated with different buttons that help you grab the moment when the button is selected. ```objectivec - (BOOL)onClickedShareButton:(UIViewController*)parentVC addShareActionItem:(NSMutableArray *)array { return [self.mainVC onClickedShareButton:parentVC addShareActionItem:array]; } - (BOOL)onClickedAudioButton:(UIViewController*)parentVC; { MobileRTCMeetingService *ms = [[MobileRTC sharedRTC] getMeetingService]; if (!ms) { return NO; } MobileRTCAudioType audioType = [ms myAudioType]; switch (audioType) { case MobileRTCAudioType_VoIP: //voip case MobileRTCAudioType_Telephony: //phone { if (![ms canUnmuteMyAudio]) { break; } BOOL isMuted = [ms isMyAudioMuted]; [ms muteMyAudio:!isMuted]; break; } case MobileRTCAudioType_None: { //Supported VOIP if ([ms isSupportedVOIP]) { if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8")) { UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"To hear others\n please join audio", @"") message:nil preferredStyle:UIAlertControllerStyleAlert]; [alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"Call via Internet", @"") style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { //Join VOIP MobileRTCMeetingService *ms = [[MobileRTC sharedRTC] getMeetingService]; if (ms) { [ms connectMyAudio:YES]; } }]]; [alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil) style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) { }]]; AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate; [[appDelegate topViewController] presentViewController:alertController animated:YES completion:nil]; } } break; } } return YES; } - (BOOL)onClickedInviteButton:(UIViewController*)parentVC addInviteActionItem:(NSMutableArray *)array { return [self.mainVC onClickedInviteButton:parentVC addInviteActionItem:array]; } - (BOOL)onClickedParticipantsButton:(UIViewController*)parentVC; { return [self.mainVC onClickedParticipantsButton:parentVC]; } - (void)onClickedDialOut:(UIViewController*)parentVC isCallMe:(BOOL)me { if (self.mainVC) { [self.mainVC onClickedDialOut:parentVC isCallMe:me]; } } ``` ## Audio service status If you want to know the moment when the meeting audio has changed, implement the following methods: ```objectivec - (void)onSinkMeetingAudioStatusChange:(NSUInteger)userID { if (self.customMeetingVC) { [self.customMeetingVC onSinkMeetingAudioStatusChange:userID]; } } - (void)onMyAudioStateChange { if (self.customMeetingVC) { [self.customMeetingVC onSinkMeetingAudioStatusChange:0]; } } ``` ## Video service status To know the video status, Zoom SDK offers multiple listeners: ```objectivec - (void)onSinkMeetingActiveVideo:(NSUInteger)userID { if (self.customMeetingVC) { [self.customMeetingVC onSinkMeetingActiveVideo:userID]; } } - (void)onSinkMeetingPreviewStopped { if (self.customMeetingVC) { [self.customMeetingVC onSinkMeetingPreviewStopped]; } } - (void)onSinkMeetingVideoStatusChange:(NSUInteger)userID { if (self.customMeetingVC) { [self.customMeetingVC onSinkMeetingVideoStatusChange:userID]; } } - (void)onMyVideoStateChange { if (self.customMeetingVC) { [self.customMeetingVC onMyVideoStateChange]; } } - (void)onSinkMeetingVideoQualityChanged:(MobileRTCNetworkQuality)qality userID:(NSUInteger)userID { NSLog(@"onSinkMeetingVideoQualityChanged: %zd userID:%zd",qality,userID); } - (void)onSinkMeetingVideoRequestUnmuteByHost:(void (^)(BOOL Accept))completion { if (completion) { completion(YES); } } ``` ## User service status To know when a user joins or leaves the meeting, implement the following methods. ```objectivec - (void)onSinkMeetingUserJoin:(NSUInteger)userID { if (self.customMeetingVC) { [self.customMeetingVC onSinkMeetingUserJoin:userID]; } } - (void)onSinkMeetingUserLeft:(NSUInteger)userID { MobileRTCMeetingService *ms = [[MobileRTC sharedRTC] getMeetingService]; MobileRTCMeetingUserInfo *leftUser = [ms userInfoByID:userID]; NSLog(@"User Left : %@", leftUser); if (self.customMeetingVC) { [self.customMeetingVC onSinkMeetingUserLeft:userID]; } } ``` To be notified when the user count changes or when a chatting occurs, implement the following methods. ```objectivec - (void)onInMeetingUserUpdated { MobileRTCMeetingService *ms = [[MobileRTC sharedRTC] getMeetingService]; NSArray *users = [ms getInMeetingUserList]; NSLog(@"In Meeting users:%@", users); } - (void)onInMeetingChat:(NSString *)messageID { MobileRTCMeetingService *ms = [[MobileRTC sharedRTC] getMeetingService]; NSLog(@"In Meeting Chat:%@ content:%@", messageID, [ms meetingChatByID:messageID]); } ``` ## Share service status Get a notification when you start sharing. ```objectivec - (void)onSinkMeetingActiveShare:(NSUInteger)userID { if (self.customMeetingVC) { [self.customMeetingVC onSinkMeetingActiveShare:userID]; } } ``` Know when the size of the sharing screen has changed. ```objectivec - (void)onSinkShareSizeChange:(NSUInteger)userID { if (self.customMeetingVC) { [self.customMeetingVC onSinkShareSizeChange:userID]; } } ``` When others are sharing something and you would like to catch the moment: ```objectivec - (void)onSinkMeetingShareReceiving:(NSUInteger)userID { if (self.customMeetingVC) { [self.customMeetingVC onSinkMeetingShareReceiving:userID]; } } ``` ## Webinar service status These listeners help you record behaviors during a webinar. ```objectivec - (void)onSinkAllowAttendeeChatNotification:(MobileRTCChatAllowAttendeeChat)currentPrivilege { NSLog(@"onSinkAllowAttendeeChatNotification %zd",currentPrivilege); } - (void)onSinkQAAllowAskQuestionAnonymouslyNotification:(BOOL)beAllowed { NSLog(@"onSinkQAAllowAskQuestionAnonymouslyNotification %zd",beAllowed); } - (void)onSinkQAAllowAttendeeViewAllQuestionNotification:(BOOL)beAllowed { NSLog(@"onSinkQAAllowAttendeeViewAllQuestionNotification %zd",beAllowed); } - (void)onSinkQAAllowAttendeeUpVoteQuestionNotification:(BOOL)beAllowed { NSLog(@"onSinkQAAllowAttendeeUpVoteQuestionNotification %zd",beAllowed); } - (void)onSinkQAAllowAttendeeAnswerQuestionNotification:(BOOL)beAllowed { NSLog(@"onSinkQAAllowAttendeeAnswerQuestionNotification %zd",beAllowed); } - (void)onSinkPromptAttendee2PanelistResult:(MobileRTCWebinarPromoteorDepromoteError)errorCode { NSLog(@"onSinkPromptAttendee2PanelistResult %zd",errorCode); } - (void)onSinkDePromptPanelist2AttendeeResult:(MobileRTCWebinarPromoteorDepromoteError)errorCode { NSLog(@"onSinkDePromptPanelist2AttendeeResult %zd",errorCode); } - (void)onSinkQAConnectStarted { MobileRTCMeetingService *ms = [[MobileRTC sharedRTC] getMeetingService]; NSLog(@"onSinkQAConnectStarted QA Enable:%d...", [ms isQAEnabled]); } - (void)onSinkQAConnected:(BOOL)connected { MobileRTCMeetingService *ms = [[MobileRTC sharedRTC] getMeetingService]; NSLog(@"onSinkQAConnected %d, QA Enable:%d...", connected, [ms isQAEnabled]); } - (void)onSinkQAOpenQuestionChanged:(NSInteger)count { NSLog(@"onSinkQAOpenQuestionChanged %zd...", count); } ``` ---