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);
});
Listens for bot authorizer relationship changes.
Only supported in meetings. Example:
ZoomMtg.inMeetingServiceListener('bot-relation-update', function (data) {
console.log('bot-relation-update', data);
// data is an array of relation objects:
// [{ parentUserID: number, childUserID: number }, ...]
// parentUserID: The user who authorized the bot
// childUserID: The bot user ID
});
Listens for sharing channel readiness to receive.
Example:
ZoomMtg.inMeetingServiceListener('receiveSharingChannelReady', function (data) {
console.log(data);
});
Listens for waiting room page status. >= 3.6.0 yourself/host/co-host can get this event
Example:
ZoomMtg.inMeetingServiceListener('onUserIsInWaitingRoom', function (data) {
console.log('onUserIsInWaitingRoom', data);
});
Listens for video preview page status.
Example:
ZoomMtg.inMeetingServiceListener('onPreviewPannel', function (data) {
console.log('onPreviewPannel', data);
});
Listens for join time status
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();
}
}
});
Listens for meeting status.
Example:
ZoomMtg.inMeetingServiceListener('onMeetingStatus', function (data: any) {
// {status: 1(connecting), 2(connected), 3(disconnected), 4(reconnecting)}
console.log(data);
});
Listens for transcriptions. Only works when "save closed captions" is on.
Example:
ZoomMtg.inMeetingServiceListener('onReceiveTranscriptionMsg', function (data) {
console.log('onReceiveTranscriptionMsg', data);
});
ZoomMtg.inMeetingServiceListener('onReceiveTranslateMsg', function (data) {
console.log('onReceiveTranslateMsg', data);
});
Listens for audio and video quality of service (QoS) events.
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);
});
Listens for claim status after calling claimHost with host key.
Example:
ZoomMtg.inMeetingServiceListener('onClaimStatus', function (data) {
console.log(data);
});
Listens for user network quality change.
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);
});
Listens for the currently displayed user and the user's video order changes. (mobile does not support.)
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);
});
Listens for onFeedBackData event.
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);
});
Listens for recording change.
Example:
ZoomMtg.inMeetingServiceListener('onRecordingChange', function (data) {
console.log(data);
});
Listens for share content change.
When data.sharingStatus is sharing, data.sharingType identifies the
selected monitor, window, browser tab, or unknown when the browser or
unknown usually means other users are sharing content.
media SDK cannot report the selected surface.
Example:
ZoomMtg.inMeetingServiceListener('onShareContentChange', function (data) {
console.log(data);
});
Listens for recording change.
Example:
ZoomMtg.inMeetingServiceListener('onReceiveChatMsg', function (data) {
console.log(data);
});
Listens for virtual background (VB) status change.
Example:
ZoomMtg.inMeetingServiceListener('onVbStatusChange', function (data) {
console.log(data);
});
Listens for media capture permission after calling request media capture permission.
Example:
ZoomMtg.inMeetingServiceListener('onMediaCapturePermissionChange', function (data) {
// {allow: true || false}
console.log(data);
});
Listens for media capture status change.
Example:
ZoomMtg.inMeetingServiceListener('onMediaCaptureStatusChange', function (data) {
// {status: 0|1|2, userId: number}
// 0=> not start, 1=> start, 2=> pause
console.log(data);
});
Listens for breakout room status change
Example:
ZoomMtg.inMeetingServiceListener('onRoomStatusChange', function (data) {
// {status: 2|3|4}
// 2=> InProgress, 3=> Closing, 4=> Closed
console.log(data);
});
Listens for focus mode status change
Example:
ZoomMtg.inMeetingServiceListener('onFocusModeStatusChange', function (data) {
// {status: boole}
console.log(data);
});
Listens for audio active speaker
Example:
ZoomMtg.inMeetingServiceListener('onActiveSpeaker', function (data) {
// [{userId: number, userName: string}]
console.log(data);
});
Listens for Picture In Picture status
Example:
ZoomMtg.inMeetingServiceListener('onPictureInPicture', function (data) {
// { pip: boolean },
console.log(data);
});
Listens for user join or leave events and handles them.