# Use meeting statuses

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

> The code on this page works with either the **default UI** or the **custom UI**.

The Zoom 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, the Meeting SDK will return the meeting
state using **MobileRTCMeetingServiceDelegate**. To listen to the meeting service, implement
these methods.

```swift
func onMeetingError(_ error: MobileRTCMeetError, message: String?) {
    print("onMeetingError: \(error) messsage: \(message)")
}

func onMeetingStateChange(_ state: MobileRTCMeetingState) {
    print("onMeetingStateChange: \(state)")
}

func onMeetingReady() {
    print("onMeetingReady")
}

func onMeetingEndedReason(_ reason: MobileRTCMeetingEndReason) {
    print("onMeetingEndedReason: \(reason)")
}
```

```objectivec
- (void)onMeetingError:(MobileRTCMeetError)error message:(NSString*)message
{
    NSLog(@"onMeetingError:%zd, message:%@", error, message);
}

- (void)onMeetingStateChange:(MobileRTCMeetingState)state
{
    NSLog(@"MobileRTC onMeetingStateChange:%@", @(state));
}

- (void)onMeetingReady
{
    NSLog(@"MobileRTC onMeetingReady");
}

- (void)onMeetingEndedReason:(MobileRTCMeetingEndReason)reason;
{
    NSLog(@"onMeetingEndedReason %d", reason);
}
```

### Join a meeting

Implement the `onJoinMeetingConfirmed` method to catch the moment
when you successfully join a meeting. There may be instances when
joining a meeting requires more information, like a display name or
password is missing, or preview confirmation is required. This is
when `onJoinMeetingInfoRequired` will be called.

```swift
func onJoinMeetingConfirmed() {
    let meetingNo = MobileRTCInviteHelper.sharedInstance().ongoingMeetingNumber
    print("onJoinMeetingConfirmed MeetingNo: \(meetingNo)")
}

func onJoinMeetingInfoRequired(_ handler: MobileRTCJoinMeetingInfoHandler) {
    print("onJoinMeetingInfoRequired: \(handler.info)")

    // Based on the handler.info above, handle it accordingly.
    handler.cancel()
    handler.confirmPreview(screenName: String?, videoOn: Bool, audioOn: Bool)
    handler.inputDisplayName(displayName: String?, password: String?)
}
```

```objectivec
- (void)onJoinMeetingConfirmed
{
    NSString *meetingNo = [[MobileRTCInviteHelper sharedInstance] ongoingMeetingNumber];
    NSLog(@"onJoinMeetingConfirmed MeetingNo: %@", meetingNo);
}

- (void)onJoinMeetingInfoRequired:(MobileRTCJoinMeetingInfoHandler *)handler
{
    NSLog(@"onJoinMeetingInfoRequired:%@", @(handler.info));

    // Based on the handler.info above, handle it accordingly.
    [handler cancel];
    [handler confirmPreview:(NSString * _Nullable) videoOn:(BOOL) audioOn:(BOOL)];
    [handler inputDisplayName:(NSString * _Nullable) password:(NSString * _Nullable)];
}
```

### Catch waiting room status changes

Implement `onWaitingRoomStatusChange` method to catch status changes in
the waiting room.

```swift
func onWaitingRoomStatusChange(_ needWaiting: Bool) {
    print("onWaitingRoomStatusChange: \(needWaiting)")
}
```

```objectivec
- (void)onWaitingRoomStatusChange:(BOOL)needWaiting {
    NSLog(@"onWaitingRoomStatusChange: %@", needWaiting ? @"true" : @"false");
}
```

### Monitor changes during a webinar

When a user tries to join a webinar that requires registration, or when a user is
missing their username or email, implement these methods.

```swift
func onSinkWebinarNeedRegister(_ registerURL: String) {
    print("onSinkWebinarNeedRegister: \(registerURL)")
}

/*
 Callback event that a user joins a webinar which requires username and email.
 Note - In default UI mode, developer can implement this method to avoid Zoom's default UI from showing
 */
func onSinkJoinWebinarNeedUserNameAndEmail(completion: @escaping (String, String, Bool) -> Bool) {
    print("onSinkJoinWebinarNeedUserNameAndEmail")

    // completion handler: User needs to provide username (first String) and email (second String) to join meeting or cancel (Bool) the join action.
    completion(String, String, Bool)
}
```

```objectivec
- (void)onSinkWebinarNeedRegister:(NSString *)registerURL
{
    NSLog(@"MobileRTC onSinkWebinarNeedRegister %@",registerURL);
}

/*
 Callback event that a user joins a webinar which requires username and email.
 Note: In Default UI mode, developer can implement this method to avoid Zoom's Default UI from showing
 */
- (void)onSinkJoinWebinarNeedUserNameAndEmailWithCompletion:(BOOL (^_Nonnull)(NSString * _Nonnull username, NSString * _Nonnull email, BOOL cancel))completion
{
    NSLog(@"onSinkJoinWebinarNeedUserNameAndEmailWithCompletion");
    // completion handler: User needs to provide username (first NSString) and email (second NSString) to join meeting or cancel (BOOL) the join action.
    completion(NSString, NSString, BOOL);
}
```

### Buttons

These methods are associated with different buttons that help
you grab the moment when the button is selected.

```swift
func onClickedShareButton(_ parentVC: UIViewController, addShareActionItem array: NSMutableArray) -> Bool {

}

func onClickedAudioButton(_ parentVC: UIViewController) -> Bool {

}

func onClickedInviteButton(_ parentVC: UIViewController, addInviteActionItem array: NSMutableArray?) -> Bool {

}

func onClickedParticipantsButton(_ parentVC: UIViewController) -> Bool {

}

func onClickedDialOut(_ parentVC: UIViewController, isCallMe me: Bool) {

}

func onClickedEndButton(_ parentVC: UIViewController, end endButton: UIButton) -> Bool {

}
```

```objectivec
- (BOOL)onClickedShareButton:(UIViewController*)parentVC addShareActionItem:(NSMutableArray *)array
{

}

- (BOOL)onClickedAudioButton:(UIViewController*)parentVC {

}

- (BOOL)onClickedInviteButton:(UIViewController*)parentVC addInviteActionItem:(NSMutableArray *)array
{

}

- (BOOL)onClickedParticipantsButton:(UIViewController*)parentVC;
{

}

- (void)onClickedDialOut:(UIViewController*)parentVC isCallMe:(BOOL)me

}

- (BOOL)onClickedEndButton:(UIViewController*)parentVC endButton:(UIButton *)endButton
{

}
```

## Get the audio service status

Learn when the meeting audio changes - mute or unmute, or setting the audio type - by implementing these methods.

```swift
func onSinkMeetingMyAudioTypeChange() {

}

func onMyAudioStateChange() {

}

func onSinkMeetingAudioTypeChange(_ userID: UInt) {

}

func onSinkMeetingAudioStatusChange(_ userID: UInt) {

}

func onSinkMeetingAudioStatusChange(_ userID: UInt, audioStatus: MobileRTC_AudioStatus) {

}

func onSinkMeetingAudioRequestUnmuteByHost() {

}

func onUserNetworkStatusChanged(\_ type: MobileRTCComponentType, level: MobileRTCNetworkQuality, userID: UInt, uplink: Bool) {
    // MobileRTCComponentType can be MobileRTCComponentType_AUDIO here
}
```

```objectivec
- (void)onSinkMeetingMyAudioTypeChange
{

}

- (void)onMyAudioStateChange
{

}

- (void)onSinkMeetingAudioTypeChange:(NSUInteger)userID
{

}

- (void)onSinkMeetingAudioStatusChange:(NSUInteger)userID
{

}

- (void)onSinkMeetingAudioStatusChange:(NSUInteger)userID audioStatus:(MobileRTC_AudioStatus)audioStatus
{

}

- (void)onSinkMeetingAudioRequestUnmuteByHost
{

}

- (void)onUserNetworkStatusChanged:(MobileRTCComponentType)type level:(MobileRTCNetworkQuality)level userID:(NSUInteger)userID uplink:(BOOL)uplink;
{
    // MobileRTCComponentType can be MobileRTCComponentType_AUDIO here
}
```

## Video service status

Learn the video status in the Meeting SDK - such as starting or stopping preview,
muting or pausing, or changing the video status - with any of these multiple listeners.

```swift
func onMyVideoStateChange() {

}

func onSinkMeetingActiveVideo(_ userID: UInt) {

}

func onSinkMeetingPreviewStopped() {

}

func onSinkMeetingVideoStatusChange(_ userID: UInt) {

}

func onSinkMeetingVideoStatusChange(_ userID: UInt, videoStatus: MobileRTC_VideoStatus) {

}

func onSinkMeetingVideoRequestUnmute(byHost completion: @escaping (Bool) -> MobileRTCSDKError) {

}

func onUserNetworkStatusChanged(\_ type: MobileRTCComponentType, level: MobileRTCNetworkQuality, userID: UInt, uplink: Bool) {
    // MobileRTCComponentType can be MobileRTCComponentType_VIDEO here
}
```

```objectivec
- (void)onMyVideoStateChange
{

}

- (void)onSinkMeetingActiveVideo:(NSUInteger)userID
{

}

- (void)onSinkMeetingPreviewStopped
{

}

- (void)onSinkMeetingVideoStatusChange:(NSUInteger)userID
{

}

- (void)onSinkMeetingVideoStatusChange:(NSUInteger)userID videoStatus:(MobileRTC_VideoStatus)videoStatus
{

}

- (void)onSinkMeetingVideoRequestUnmuteByHost:(MobileRTCSDKError (^)(BOOL Accept))completion
{

}

- (void)onUserNetworkStatusChanged:(MobileRTCComponentType)type level:(MobileRTCNetworkQuality)level userID:(NSUInteger)userID uplink:(BOOL)uplink;
{
    // MobileRTCComponentType can be MobileRTCComponentType_VIDEO here
}
```

## User join or leave status

To know when a user joins or leaves the meeting,
implement these methods.

```swift
func onMyVideoStateChange() {

}

func onSinkMeetingActiveVideo(_ userID: UInt) {

}

func onSinkMeetingPreviewStopped() {

}

func onSinkMeetingVideoStatusChange(_ userID: UInt) {

}

func onSinkMeetingVideoStatusChange(_ userID: UInt, videoStatus: MobileRTC_VideoStatus) {

}

func onSinkMeetingVideoRequestUnmute(byHost completion: @escaping (Bool) -> MobileRTCSDKError) {

}

func onUserNetworkStatusChanged(\_ type: MobileRTCComponentType, level: MobileRTCNetworkQuality, userID: UInt, uplink: Bool) {
  // MobileRTCComponentType can be MobileRTCComponentType_VIDEO here
}
```

```objectivec
- (void)onMyVideoStateChange
{

}

- (void)onSinkMeetingActiveVideo:(NSUInteger)userID
{

}

- (void)onSinkMeetingPreviewStopped
{

}

- (void)onSinkMeetingVideoStatusChange:(NSUInteger)userID
{

}

- (void)onSinkMeetingVideoStatusChange:(NSUInteger)userID videoStatus:(MobileRTC_VideoStatus)videoStatus
{

}

- (void)onSinkMeetingVideoRequestUnmuteByHost:(MobileRTCSDKError (^)(BOOL Accept))completion
{

}

- (void)onUserNetworkStatusChanged:(MobileRTCComponentType)type level:(MobileRTCNetworkQuality)level userID:(NSUInteger)userID uplink:(BOOL)uplink;
{
    // MobileRTCComponentType can be MobileRTCComponentType_VIDEO here
}
```

## Get the user service status

Learn when a user joins or leaves a meeting or webinar.

```swift
func onSinkMeetingUserJoin(_ userID: UInt) {

}

func onSinkMeetingUserLeft(_ userID: UInt) {

}
```

```objectivec
- (void)onSinkMeetingUserJoin:(NSUInteger)userID
{

}

- (void)onSinkMeetingUserLeft:(NSUInteger)userID
{

}
```

## Get the Share service status

Get a notification when meeting participants start sharing.

```
func onShareContentChanged(\_ shareInfo: MobileRTCSSharingSourceInfo) {

}

func onSinkShareSettingTypeChanged(\_ shareSettingType: MobileRTCShareSettingType) {

}

func onSinkShareSizeChange(\_ userID: UInt) {

}

func onUserNetworkStatusChanged(\_ type: MobileRTCComponentType, level: MobileRTCNetworkQuality, userID: UInt, uplink: Bool) { // MobileRTCComponentType can be MobileRTCComponentType_SHARE here }

```

```objectivec
- (void)onSinkSharingStatus:(MobileRTCSSharingSourceInfo*_Nonnull)shareInfo
{

}

- (void)onShareContentChanged:(MobileRTCSSharingSourceInfo*_Nonnull)shareInfo
{

}

- (void)onSinkShareSettingTypeChanged:(MobileRTCShareSettingType)shareSettingType
{

}

- (void)onSinkShareSizeChange:(NSUInteger)userID
{

}

- (void)onUserNetworkStatusChanged:(MobileRTCComponentType)type level:(MobileRTCNetworkQuality)level userID:(NSUInteger)userID uplink:(BOOL)uplink;
{
    // MobileRTCComponentType can be MobileRTCComponentType_SHARE here
}
```

`

---
