Zoom Meeting SDK for Web
    Preparing search index...

    Function inMeetingServiceListener

    • Listens for user join or leave events and handles them.

      Parameters

      • event: "onUserJoin" | "onUserLeave" | "onUserUpdate"
      • callback: Function

        Only supported in meetings. Example:

        ZoomMtg.inMeetingServiceListener('onUserJoin', function (data) {
        console.log(data);
        });

        ZoomMtg.inMeetingServiceListener('onUserLeave', function (data) {
        console.log(data);
        // reasonCode Return the reason the current user left.
        const reasonCode = {
        OTHER: 0, // Other reason.
        HOST_ENDED_MEETING: 1, // Host ended the meeting.
        SELF_LEAVE_FROM_IN_MEETING: 2, // User (self) left from being in the meeting.
        SELF_LEAVE_FROM_WAITING_ROOM: 3, // User (self) left from the waiting room.
        SELF_LEAVE_FROM_WAITING_FOR_HOST_START: 4, // User (self) left from waiting for host to start the meeting.
        MEETING_TRANSFER: 5, // The meeting was transferred to another end to open.
        KICK_OUT_FROM_MEETING: 6, // Removed from meeting by host or co-host.
        KICK_OUT_FROM_WAITING_ROOM: 7, // Removed from waiting room by host or
        co-host.
        LEAVE_FROM_DISCLAIMER: 8, // User click cancel in disclaimer dialog
        };

        });

        ZoomMtg.inMeetingServiceListener('onUserUpdate', function (data) {
        console.log(data);
        });

      Returns void

    • Listens for sharing channel readiness to receive.

      Parameters

      • event: "receiveSharingChannelReady"
      • callback: Function

        Example:

        ZoomMtg.inMeetingServiceListener('receiveSharingChannelReady', function (data) {
        console.log(data);
        });

      Returns void

    • Listens for waiting room page status. >= 3.6.0 yourself/host/co-host can get this event

      Parameters

      • event: "onUserIsInWaitingRoom"
      • callback: Function

        Example:


        ZoomMtg.inMeetingServiceListener('onUserIsInWaitingRoom', function (data) {
        console.log('onUserIsInWaitingRoom', data);
        });

      Returns void

    • Listens for video preview page status.

      Parameters

      • event: "onPreviewPannel"
      • callback: Function

        Example:


        ZoomMtg.inMeetingServiceListener('onPreviewPannel', function (data) {
        console.log('onPreviewPannel', data);
        });

      Returns void

    • Listens for join time status

      Parameters

      • event: "onJoinSpeed"
      • callback: Function

        The following is an example that returns the join speed after specific events, useful for building a dashboard or troubleshooting.

        var testTool = {
        joinSpeedTag: {
        sdkCallInit: 0, // not recorded, you can record in init success callback.
        sdkCallJoin: 1,
        userInPreviewPage: 2,
        userClickJoinPreview: 3,
        userInWaitingForHost: 4,
        userOutWaitingForHost: 5,
        userInWaitingRoom: 6,
        userOutWaitingRoom: 7,
        userJoinRWGSuccess: 8,
        userAudioDecodeSuccess: 9,
        userVideoDecodeSuccess: 10,
        userAudioEncodeSuccess: 11,
        userVideoEncodeSuccess: 12,
        userStartJoinAudio: 13,
        userJoinAudioSuccess: 14,
        userStartJoinVideo: 15,
        userJoinVideoSuccess: 16,
        userAudioVideoSuccess: 17, // not recorded, when all steps from 8 - 16 are true.
        },
        joinSpeed: [
        {
        tag: 'JOIN_SPEED',
        level: 0,
        text: 'sdk init',
        time: 0,
        timeStr: '',
        },
        {
        tag: 'JOIN_SPEED',
        level: 1,
        text: 'sdk call join',
        time: 0,
        timeStr: '',
        },
        {
        tag: 'JOIN_SPEED',
        level: 2,
        text: 'user in preview page',
        time: 0,
        timeStr: '',
        },
        {
        tag: 'JOIN_SPEED',
        level: 3,
        text: 'user clicks join from preview',
        time: 0,
        timeStr: '',
        },
        {
        tag: 'JOIN_SPEED',
        level: 4,
        text: 'user waiting for host',
        time: 0,
        timeStr: '',
        },
        {
        tag: 'JOIN_SPEED',
        level: 5,
        text: 'user poll meeting started, start join',
        time: 0,
        timeStr: '',
        },
        {
        tag: 'JOIN_SPEED',
        level: 6,
        text: 'user in waiting room',
        time: 0,
        timeStr: '',
        },
        {
        tag: 'JOIN_SPEED',
        level: 7,
        text: 'user exits waiting room',
        time: 0,
        timeStr: '',
        },
        {
        tag: 'JOIN_SPEED',
        level: 8,
        text: 'user join success',
        time: 0,
        timeStr: '',
        },
        {
        tag: 'JOIN_SPEED',
        level: 9,
        text: 'user join success with audio decode init success',
        time: 0,
        timeStr: '',
        },
        {
        tag: 'JOIN_SPEED',
        level: 10,
        text: 'user join success with video decode init success',
        time: 0,
        timeStr: '',
        },
        {
        tag: 'JOIN_SPEED',
        level: 11,
        text: 'user join success with audio encode init success',
        time: 0,
        timeStr: '',
        },
        {
        tag: 'JOIN_SPEED',
        level: 12,
        text: 'user join success with video encode init success',
        time: 0,
        timeStr: '',
        },
        {
        tag: 'JOIN_SPEED',
        level: 13,
        text: 'user start join audio',
        time: 0,
        timeStr: '',
        },
        {
        tag: 'JOIN_SPEED',
        level: 14,
        text: 'user join audio success',
        time: 0,
        timeStr: '',
        },
        {
        tag: 'JOIN_SPEED',
        level: 15,
        text: 'user start join video',
        time: 0,
        timeStr: '',
        },
        {
        tag: 'JOIN_SPEED',
        level: 16,
        text: 'user join video success',
        time: 0,
        timeStr: '',
        },
        {
        tag: 'JOIN_SPEED',
        level: 17,
        text: 'user audio and video on (join finish)',
        time: 0,
        timeStr: '',
        },
        ],
        setJoinTime: function(joinTimeObj) {
        if (typeof joinTimeObj === 'object') {
        var tmpIndex = joinTimeObj.level;
        this.joinSpeed[tmpIndex] = Object.assign({}, joinTimeObj);
        return true;
        }
        return false;
        },
        setJoinTimeLevel: function(level, tmpTime) {
        var currentTimestamp = Date.now();
        if (tmpTime) {
        currentTimestamp = tmpTime;
        }
        var tmpIndex = this.joinSpeed.findIndex((item) => item.level === level);
        if (tmpIndex !== -1) {
        this.joinSpeed[tmpIndex] = Object.assign({}, this.joinSpeed[tmpIndex], {
        time: currentTimestamp,
        timeStr: new Date(currentTimestamp).toISOString(),
        });
        return true; // Indicates that item was replaced successfully
        }
        return false; // Indicates that item was not found
        },
        printObjectsAsTable: function(objectsArray) {
        // Extract keys (properties) from the first object to use as table headers
        var tmpHeaders = Object.keys(objectsArray[0]);

        // Find the maximum length of each column
        const maxLengths = tmpHeaders.map((header) =>
        Math.max(...objectsArray.map((obj) => String(obj[header]).length)),
        );

        // Print table tmpHeaders
        var headerRow = '';
        tmpHeaders.forEach((header, index) => {
        headerRow += header.padEnd(maxLengths[index] + 2);
        });
        console.log(headerRow);

        // Print table rows
        objectsArray.forEach((obj) => {
        var row = '';
        tmpHeaders.forEach((header, index) => {
        row += String(obj[header]).padEnd(maxLengths[index] + 2);
        });
        console.log(row);
        });
        },
        printJoinTime: function() {
        console.log('%c===============JOIN SPEED ================', 'color: red');

        if (!this.joinSpeed[this.joinSpeedTag.userOutWaitingRoom].time && this.joinSpeed[this.joinSpeedTag.userOutWaitingForHost].time) {
        //console.log(this.joinSpeed[this.joinSpeedTag.userAudioVideoSuccess].time, this.joinSpeed[this.joinSpeedTag.userOutWaitingForHost].time);
        console.warn('Your join time started from "out waiting for host":', this.joinSpeed[this.joinSpeedTag.userAudioVideoSuccess].time - this.joinSpeed[this.joinSpeedTag.userOutWaitingForHost].time, 'ms');
        }

        if (this.joinSpeed[this.joinSpeedTag.userOutWaitingRoom].time) {
        console.warn('Your join time started from "out waiting room":', this.joinSpeed[this.joinSpeedTag.userAudioVideoSuccess].time - this.joinSpeed[this.joinSpeedTag.userOutWaitingRoom].time, 'ms');
        } else if (this.joinSpeed[this.joinSpeedTag.userClickJoinPreview].time) {
        console.warn('Your join time started from clicking the join button in preview:', this.joinSpeed[this.joinSpeedTag.userAudioVideoSuccess].time - this.joinSpeed[this.joinSpeedTag.userClickJoinPreview].time, 'ms');
        } else {
        console.warn('Your join time started from calling SDK join:', this.joinSpeed[this.joinSpeedTag.userAudioVideoSuccess].time - this.joinSpeed[this.joinSpeedTag.sdkCallJoin].time, 'ms');
        }
        this.printObjectsAsTable(this.joinSpeed);
        }
        }

        ZoomMtg.inMeetingServiceListener('onJoinSpeed', function (data) {
        console.log('inMeetingServiceListener onJoinSpeed', data);
        testTool.setJoinTime(data);

        var tmpCheckJoin = true;
        [testTool.joinSpeedTag.userAudioDecodeSuccess,
        testTool.joinSpeedTag.userVideoDecodeSuccess,
        testTool.joinSpeedTag.userAudioEncodeSuccess,
        testTool.joinSpeedTag.userVideoEncodeSuccess,
        testTool.joinSpeedTag.userStartJoinAudio,
        testTool.joinSpeedTag.userJoinAudioSuccess,
        testTool.joinSpeedTag.userStartJoinVideo,
        testTool.joinSpeedTag.userJoinVideoSuccess,
        ].forEach(item=>{
        if (!testTool.joinSpeed[item].time) {
        tmpCheckJoin = tmpCheckJoin & false;
        }

        });
        if (tmpCheckJoin) {
        if (!testTool.joinSpeed[testTool.joinSpeedTag.userAudioVideoSuccess].time) {
        testTool.setJoinTimeLevel(testTool.joinSpeedTag.userAudioVideoSuccess)
        //user audio and video on(join finish)
        testTool.printJoinTime();
        }
        }
        });


      Returns void

      EventName onJoinSpeed

    • Listens for meeting status.

      Parameters

      • event: "onMeetingStatus"
      • callback: Function

        Example:

        ZoomMtg.inMeetingServiceListener('onMeetingStatus', function (data) {
        // {status: 1(connecting), 2(connected), 3(disconnected), 4(reconnecting)}
        console.log(data);
        });

      Returns void

    • Listens for transcriptions. Only works when "save closed captions" is on.

      Parameters

      • event: "onReceiveTranscriptionMsg" | "onReceiveTranslateMsg"
      • callback: Function

        Example:


        ZoomMtg.inMeetingServiceListener('onReceiveTranscriptionMsg', function (data) {
        console.log('onReceiveTranscriptionMsg', data);
        });

        ZoomMtg.inMeetingServiceListener('onReceiveTranslateMsg', function (data) {
        console.log('onReceiveTranslateMsg', data);
        });

      Returns void

    • Listens for audio and video quality of service (QoS) events.

      Parameters

      • event: "onAudioQos" | "onVideoQos" | "onShareQos"
      • callback: Function

        Example:

        ZoomMtg.inMeetingServiceListener('onAudioQos', function (data) {
        console.log('onAudioQos', data);
        });

        ZoomMtg.inMeetingServiceListener('onVideoQos', function (data) {
        console.log('onVideoQos', data);
        });

        ZoomMtg.inMeetingServiceListener('onShareQos', function (data) {
        console.log('onShareQos', data);
        });

      Returns void

    • Listens for claim status after calling claimHost with host key.

      Parameters

      • event: "onClaimStatus"
      • callback: Function

        Example:

        ZoomMtg.inMeetingServiceListener('onClaimStatus', function (data) {
        console.log(data);
        });

      Returns void

    • Listens for user network quality change.

      Parameters

      • event: "onNetworkQualityChange"
      • callback: Function

        Example:

        ZoomMtg.inMeetingServiceListener('onNetworkQualityChange', function (data) {
        // {level: 0 || 1 || 2 || 3 || 4 || 5, userId, type: 'uplink' }
        // 0,1 => bad; 2 => normal; 3,4,5 => good;
        console.log(data);
        });

      Returns void

    • Listens for the currently displayed user and the user's video order changes. (mobile does not support.)

      Parameters

      • event: "onVideoOrder"
      • callback: Function

        Example:

        ZoomMtg.inMeetingServiceListener('onVideoOrder', function (data) {
        // {
        // view: 'speak-view' | 'gallery-view' | 'multi-speaker-view' | 'single-view',
        // speakerBarCurrent: [],
        // speakerActiveCurrent: [],
        // multiSpeakerActiveCurrent: [],
        // multiSpeakerMainCurrent: [],
        // galleryMainCurrent: [],
        // suspensionAllCurrent: [],
        // singleActiveCurrent: [],
        // };
        console.log(data);
        });

      Returns void

    • Listens for onFeedBackData event.

      Parameters

      • event: "onFeedBackData"
      • callback: Function
        • The callback receives an object containing feedback data.

        The data object passed to the callback contains the following fields:

        • enableFeedback (number): Web-configured feedback setting. Possible values:
          • 1: Feedback displayed randomly in meetings.
          • 2: Feedback displayed in every meeting.
        • enableFeedbackTextField (boolean): Indicates whether the text field for user feedback is enabled.
        • feedbackCustMessage (string): Custom message displayed to users, as configured on the web.
        • survey (string | boolean): The survey URL if a survey is set up for the meeting; otherwise, false.
        • nodeId (number): The unique identifier of the user.
        • meetingDetails (string): Binary representation of conference features.
        • deviceType (string): The type of device used to join the meeting (e.g., "Mobile" or "Desktop").
        • meetingNumber (number): The unique meeting number.
        • meetingId (string): The unique meeting identifier.
        • trackingId (string): A tracking identifier for logs.
        • confId (string): The in-meeting service link identifier.

        Example:

        ZoomMtg.inMeetingServiceListener('onFeedBackData', function (data) {
        console.log(data);
        });

      Returns void

    • Listens for recording change.

      Parameters

      • event: "onRecordingChange"
      • callback: Function

        Example:

        ZoomMtg.inMeetingServiceListener('onRecordingChange', function (data) {
        console.log(data);
        });

      Returns void

    • Listens for share content change.

      Parameters

      • event: "onShareContentChange"
      • callback: Function

        Example:

        ZoomMtg.inMeetingServiceListener('onShareContentChange', function (data) {
        console.log(data);
        });

      Returns void

    • Listens for recording change.

      Parameters

      • event: "onReceiveChatMsg"
      • callback: Function

        Example:

        ZoomMtg.inMeetingServiceListener('onReceiveChatMsg', function (data) {
        console.log(data);
        });

      Returns void

    • Listens for virtual background (VB) status change.

      Parameters

      • event: "onVbStatusChange"
      • callback: Function

        Example:

         ZoomMtg.inMeetingServiceListener('onVbStatusChange', function (data) {
        console.log(data);
        });

      Returns void

    • Listens for media capture permission after calling request media capture permission.

      Parameters

      • event: "onMediaCapturePermissionChange"
      • callback: Function

        Example:

        ZoomMtg.inMeetingServiceListener('onMediaCapturePermissionChange', function (data) {
        // {allow: true || false}
        console.log(data);
        });

      Returns void

    • Listens for media capture status change.

      Parameters

      • event: "onMediaCaptureStatusChange"
      • callback: Function

        Example:

        ZoomMtg.inMeetingServiceListener('onMediaCaptureStatusChange', function (data) {
        // {status: 0|1|2, userId: number}
        // 0=> not start, 1=> start, 2=> pause
        console.log(data);
        });

      Returns void

    • Listens for breakout room status change

      Parameters

      • event: "onRoomStatusChange"
      • callback: Function

        Example:

        ZoomMtg.inMeetingServiceListener('onRoomStatusChange', function (data) {
        // {status: 2|3|4}
        // 2=> InProgress, 3=> Closing, 4=> Closed
        console.log(data);
        });

      Returns void

    • Listens for focus mode status change

      Parameters

      • event: "onFocusModeStatusChange"
      • callback: Function

        Example:

        ZoomMtg.inMeetingServiceListener('onFocusModeStatusChange', function (data) {
        // {status: boole}
        console.log(data);
        });

      Returns void

    • Listens for audio active speaker

      Parameters

      • event: "onActiveSpeaker"
      • callback: Function

        Example:

        ZoomMtg.inMeetingServiceListener('onActiveSpeaker', function (data) {
        // [{userId: number, userName: string}]
        console.log(data);
        });

      Returns void

    • Listens for Picture In Picture status

      Parameters

      • event: "onPictureInPicture"
      • callback: Function

        Example:

        ZoomMtg.inMeetingServiceListener('onPictureInPicture', function (data) {
        // { pip: boolean },
        console.log(data);
        });

      Returns void