Renames your name or another user's name.
client.isAllowToRename()
to get the value.New display name.
User ID of the user to rename.
Get the in-session participants of the session.
Gets the chat client.
Gets the command client.
Gets the current user info.
Gets the liveStream client.
Gets the LiveTranscription client.
Gets the logger client.
logger option
Gets the media stream instance for managing the media.
This usually the first step of using media.
Gets the recording client.
Gets the host of the session.
Gets the current session’s information.
Gets the subsession client.
Gets the user by user ID.
Initializes the Zoom Video SDK before join a session. The Zoom Video SDK uses an SDK key & secret for authentication.
The language of the Video SDK. The default is en-US
.
The Zoom Video SDK uses web workers and web assembly to process the media stream.
This part of the code is separate from the SDK code, so you must specify the dependent assets path.
Each SDK release includes the web worker and the web assembly assets in the lib
folder.
You can either deploy these assets to your private servers or use the cloud assets provided by Zoom.
The property has following value:
Global
: The default value. The dependent assets path will be https://source.zoom.us/videosdk/{version}/lib/
CDN
: The dependent assets path will be https://dmogdx0jrul3u.cloudfront.net/videosdk/{version}/lib/
CN
: Only applicable for China. The dependent assets path will be https://jssdk.zoomus.cn/videosdk/{version}/lib{FULL_ASSETS_PATH}
: The SDK will load the dependent assets specified by the developer.Optional additional options for initialization.
Determines whether the current user is the host.
Determines whether the current user is a manager.
Determines whether the current user is the original host.
role_type
in JWT payload =1 is the original host.
init
method before joining.Required. A session name of your choice or the name of the session you are joining (must match the SWK JWT tpc
value).
Required. Your Video SDK JWT, which you should generate on the server.
Required. A name for the user.
Optional, unless it was set with the host. A session password of your choice. If set with the host, all attendees must provide the same password value or they will fail to join the session.
Optional. The number of minutes your session can idle before ending, with one user present and without cloud recording. The default is 40 minutes.
an executed promise. Following are the possible error reasons:
duplicated operation
: Duplicated invoking of the join
method.invalid apiKey/sdkKey or signature
: API key, SDK key, or signature is not correct.invalid password
: Password is not correct.invalid parameters
: Can not join the session because of invalid parameters.internal error
: Internal error.Leaves or ends the session.
Optional. Default is false. If true, the session ends. Only the host has the privilege to do this.
Makes other participant the host.
Makes another participant a manager.
Removes the event handler.
Event name.
The event handler.
Listens for events and handles them.
Event name.
Ehe event handler.
Details in event_connection_change.
Occurs when the connection is changed.
The event detail.
Details in event_user_add.
Occurs when a new participant joins the session.
client.on('user-added',(payload)=>{
// You can refresh the participants when
const participants = client.getParticipantsList();
})
The event detail.
Details in event_user_update.
Occurs when the properties of the participant are updated.
The event detail
Details in event_user_remove.
Occurs when the participant leaves the session.
The event detail
Details in event_video_active_change.
Occurs when the remote video stream changes.
client.on("video-active-change", async (payload) => {
try {
if (payload.state === "Active") {
const element = await stream.attachVideo(userId, VideoQuality.Video_720P);
container.appendChild(element);
} else {
const elements = await stream.detachVideo(userId);
if (Array.isArray(elements)) {
elements.forEach((e) => e.remove());
} else {
elements.remove();
}
}
} catch (error) {
console.log(error);
}
});
The event detail.
Active video state.
User ID.
Details in event_video_dimension_change.
Occurs when the received video content dimension changes.
client.on('video-dimension-change', payload=>{
viewportElement.style.width = `${payload.width}px`;
viewportElement.style.height = `${payload.height}px`;
})
Height.
Type: Received video.
Width.
Details in event_audio_active_speaker.
Occurs when some participants in the session are talking.
client.on('active-speaker', (payload) => {
console.log(`Active user:`,payload);
});
Active user.
Details in {@link event_audio_unmute_consent}.
Occurs when the host asks you to unmute audio.
The event detail.
Spotlight
: Host spotlighted you. If you are muted, you will receive the consent message.Unmute
: Host asks you to unmute audio.Allow to talk
: You are an attendee of a webinar, the host allowed you to talk.client.on('host-ask-unmute-audio', (payload) => {
console.log(payload.reason);
});
The unmute consent reason.
Details in event_current_audio_change.
Occurs when current audio is changed.
The event detail.
join
: Join audio. Refer to the type
attribute for details.leave
: Leave audio.muted
: Audio muted, refer to the source
attribute for details.unmuted
: Audio unmuted, refer to the source
attribute for details.phone
: Join by phone.active
: User active action.passive(mute all)
: Muted due to the host muting all.passive(mute one)
: Muted due to the host muting you.passive
: Umnuted due to the host unmuting you.client.on('current-audio-change', (payload) => {
if(payload.action==='join'){
console.log('Joined by ',payload.type);
}
});
The current audio change action.
If the action is muted, an extra field to show the muted source.
Type of audio.
Details in event_dial_out_change.
Occurs when the dial-out state changes.
client.on('dialout-state-change', (payload) => {
console.log(payload.code);
});
The state code of the phone call.
Phone number
Phone user ID
Unique ID for the call
Detail in event_audio_statistic_data_change.
Occurs when the audio statistics data is changed; decode (received).
The event detail.
data
encoding
: If encoding is true, the following metrics stand for the Send data statistics, otherwise, it stands for the Receive data statistics.avg_loss
: Audio's average package loss.jitter
: Audio's jitter.max_loss
: Audio's maximum package loss.rtt
: Audio's round trip time.sample_rate
: Audio's sample rate.type
: String AUDIO_QOS_DATA
client.on('audio-statistic-data-change', (payload) => {
console.log('emit', payload);
});
Data
Audio's Average package loss.
Bandwidth, measured in bits per second (bps)
Bit rate, measured in bits per second (bps)
If encoding is true, the following metrics stand for the Send data statistics, otherwise, it stands for the Receive data statistics.
Audio's jitter.
Audio's maximum package loss.
Audio's round trip time.
Audio's sample rate.
Type.
Detail in event_video_statistic_data_change.
Occurs when the video statistics data is changed; decode (received).
The event detail
data
encoding
: If encoding is true, the following metrics stand for the Send data statistics, otherwise, it stands for the Receive data statistics.avg_loss
: Video's average package loss.jitter
: Video's jitter.max_loss
: Video's maximum package loss.rtt
: Video's round trip time.sample_rate
: Video's sample rate.width
: Video's width.height
: Video's height.fps
: Video's frame rate in frames per second (FPS).type
: String VIDEO_QOS_DATA
client.on('video-statistic-data-change', (payload) => {
console.log('emit', payload);
});
Data.
Video's average package loss.
Bandwidth, measured in bits per second (bps)
Bit rate, measured in bits per second (bps)
If encoding is true, the following metrics stand for the Send data statistics, otherwise, it stands for the Receive data statistics.
Video's frame rate in frames per second (FPS).
Video's resolution height.
Video's jitter.
Video's maximum package loss.
Video's round trip time.
Video's sample rate.
Video's resolution width.
Type.
Details in event_chat_received_message.
Occurs when receiving a chat.
The event details.
client.on('chat-on-message',payload=>{
console.log('from %s, message:%s',payload.sender.name,payload.message);
})
Details in event_chat_privilege_change.
Occurs when the host changes the chat privileges.
The event detail.
client.on('chat-privilege-change',payload=>{
console.log(payload.chatPrivilege);
})
Chat privilege.
Details in event_command_channel_status.
Occurs when the command channel status changes.
client.on('command-channel-status',payload=>{
console.log('from %s, message:%s',payload);
})
Details in event_command_channel_message.
Occurs when command channel receives a message.
The event details.
client.on('command-channel-message',payload=>{
console.log('from %s, message:%s',payload.senderId, payload.text, payload.timestamp);
})
Message ID.
Sender's user ID.
Sender's display name.
Message content.
Timestamp.
Details in event_recording_change.
Occurs when the cloud recording status changes.
The recording status.
Recording status.
Details in {@link event_iso_recording_change}.
Occurs when the individual cloud recording status changes.
The individual recording status.
state
The user ID being recorded.
Details in event_auto_play_audio_failed.
Occurs when the SDK tried and failed to auto play audio. This may occur when invoking stream.startAudio()
immediately after joining the session.
client.on('auto-play-audio-failed',()=>{
console.log('auto play audio failed, waiting user's interaction');
})
Details in event_device_change.
Occurs when adding or removing the microphone, speaker, or camera.
Chrome browser on Android devices does not trigger the device-change
event when the headset is plugged in or unplugged. See browser compatibility: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/devicechange_event#browser_compatibility.
Details in event_video_capturing_change.
Occurs when the local video capture stream changes.
client.on('video-capturing-change', (payload) => {
try {
if (payload.state === 'Started') {
console.log('Capture started');
} else if (payload.state === 'Stopped') {
console.log('Capture stopped');
} else {
console.log('Stop capturing Failed');
}
} catch (error) {
console.log(error);
}
});
The event detail.
Video capture state.
Details in event_active_share_change.
Occurs when some participant starts screen sharing.
client.on('active-share-change',payload=>{
if(payload.state==='Active'){
stream.startShareView(canvas,payload.userId);
}else if(payload.state==='Inactive'){
stream.stopShareView();
}
})
Sharing state.
User ID of active share.
Details in event_share_content_dimension_change.
Occurs when shared content dimensions change.
client.on('share-content-dimension-change',payload=>{
viewportElement.style.width = `${payload.width}px`;
viewportElement.style.height = `${payload.height}px`;
})
Height.
Values: sended: current share; received: others' share.
Width.
Details in event_peer_share_state_change.
Occurs when some participant starts or stops screen sharing.
client.on('peer-share-state-change',payload=>{
if(payload.action==='Start'){
console.log(`user:${payload.userId} starts share`);
}else if(payload.action==='Stop'){
console.log(`user:${payload.userId} stops share`);
}
})
Peer share action.
User ID.
Details in event_share_privilege_change.
Occurs when the host changes the share privileges.
Share privilege.
Details in event_passively_stop_share.
Occurs when current sharing is passively stopped.
Details in event_share_content_change.
Occurs when received shared content automatically changes.
User ID currently receiving sharing.
Details in event_peer_video_state_change.
Occurs when other participants start or stop video.
client.on("peer-video-state-change", async (payload) => {
if (payload.action === "Start") {
const element = await stream.attachVideo(userId, VideoQuality.Video_720P);
container.appendChild(element);
} else if (payload.action === "Stop") {
const elements = await stream.detachVideo(userId);
if (Array.isArray(elements)) {
elements.forEach((e) => e.remove());
} else {
elements.remove();
}
}
});
Action of the peer video, Start
or Stop
.
User ID.
Details inevent_share_audio_change
Occurs when the share audio state changes. Usually used to cooperatively change the state of computer audio.
The state of the Chrome browser shared tab audio.
Details in event_bo_invite_to_join.
Occurs when the host assigns you to a subsession. You can decide whether to join the subsession or not.
Use SubsessionClient.joinSubsession(subsessionId)
to join the subsession.
Subsession ID.
Subsession name.
Details in event_bo_room_countdown.
Occurs when the subsession has a countdown. This event will be triggered every second until time is up.
Countdown for subsession.
Details in event_bo_room_time_up.
Occurs when the countdown is over.
Details in event_bo_closing_room_countdown.
Occurs when there is a buffer countdown when the subsession is about to be closed. This event will be triggered every second until the countdown is over.
Countdown for closing the subsession.
Details in event_bo_broadcast_message.
Occurs when the host broadcasts content to all in the subsession.
Broadcast message.
Details in event_bo_ask_for_help.
Occurs when the host receives a request for help from a user in a subsession.
User's display name.
Subsession ID.
Subsession name.
User ID of the user who requested help.
Details in event_bo_ask_for_help_response.
Occurs when the attendee received the response for the request for help.
The response for the request for help.
Details in event_bo_room_state_change.
Occurs when the status of the subsession changes.
Subsession's status.
Details in event_bo_main_session_change.
Occurs when the host is in the subsession and the main session user changed.
Details in event_video_vb_preload_change
Occurs when the virtual background (VB) is enabled and the VB model is loaded.
Is ready to apply the virtual background.
Details in event_media_sdk_change
Details in event_video_cell_detailed_change
Occurs on video cell statistic data changes.
Video frame rate in frames per second.
Video resolution height.
Video quality.
User ID.
Video resolution width.
Details in event_caption_status
Occurs when the live transcription status changes.
the event detail
client.on('caption-status',payload=>{
console.log(payload);
})
Is auto caption enabled.
Language code.
Details in event_caption_message
Occurs when the SDK receives the live transcription, live translation, or manual captions message.
the event detail
client.on('caption-message',payload=>{
console.log(payload);
})
Details in event_caption_enable
Occurs if the automatic live transcription enable status changes.
Details in event_share_can_see_screen
Occurs when the requestReadReceipt
option is true in the startShareScreen
method. The sharer can receive the event if someone can see the shared screen.
Details in event_far_end_camera_request
Occurs when the SDK received the far end camera request.
the event detail
The display name who is controlling the camera.
The user ID who is controlling the camera.
The display name who requested control.
The user ID who requested control.
Details in event_far_end_camera_response
Occurs when the SDK received the far end camera response.
The event detail.
Display name.
Is approved.
Reason for refusal.
User ID.
Details in event_far_end_camera_in_control_change
Occurs when the camera in control status changes.
The event detail.
Is controlled by other user.
User ID.
Details in event_far_end_camera_capability_change
Occurs when camera capability changes.
Capabilities of Pan-Tilt-Zoom (PTZ) camera.
User ID.
Details in event_network_quality_change
Occurs when network quality changes. The network quality reflects the video quality, so only when the user starts video, the data will broadcast to all users.
the network quality
Level 0,1: bad 2: normal 3,4,5: good
Uplink or downlink.
User ID.
Details in event_share_statistic_data_change
Occurs when the share statistics data is changed during decoding (received) or encoding (sent)
the event detail
data
encoding
: If encoding is true, the following metrics stand for the Send data statistics, otherwise, it stands for the Receive data statistics.avg_loss
: average package loss for videojitter
: jitter for videomax_loss
: max package loss for videortt
: round trip time for videosample_rate
: sample rate videowidth
: width for videoheight
: height for videofps
: Frames per second (FPS) for videotype
: string "VIDEOSHARE_QOS_DATA"client.on('share-statistic-data-change', (payload) => {
console.log('emit', payload);
});
Quality of Service (QoS) data.
Share's average package loss. (On Safari or Firefox, this value is always 0)
Bandwidth, measured in bits per second (bps)
Bit rate, measured in bits per second (bps)
If encoding is true, the following metrics stand for the Send data statistics, otherwise, it stands for the Receive data statistics.
Share's frame rate in frames per second (FPS).
Share's resolution height.
Share's jitter. (On Safari or Firefox, this value is always 0)
Share's maximum package loss. (On Safari or Firefox, this value is always 0)
Share's round trip time. (On Safari or Firefox, this value is always 0)
Share's sample rate. (On Safari or Firefox, this value is always 0)
Share's resolution width.
Details in event_caption_host_disable
Occurs when the host disables caption.
boolean
Details in {@link event_remote_control_approved_change}
Details in {@link event_remote_control_in_control_change}
Details in {@link event_remote_control_clipboard_change}
Details in {@link event_remote_control_request_change}
Details in {@link event_remote_control_app_status_change}
Details in {@link event_remote_control_controlled_status_change}
Details in event_live_stream_status
Occurs when live stream status changes.
Details in event_video_aspect_ratio_change
Occurs when the SDK detects that the rendered video aspect ratio is not the same as the actual video aspect ratio.
To correct the aspect ratio, update aspect-ratio
CSS style to correct the ratio.
client.on("video-aspect-ratio-change", (payload) => {
const { userId, aspectRatio } = payload;
const videoPlayerElement = // look up the video-player element by userId
videoPlayerElement.style.aspectRatio = aspectRatio;
});
Aspect ratio.
User ID.
Details in event_device_permission_change
Occurs when the SDK detects that the device permission has changed.
device type
permission state
Details in event_chat_file_upload_progress
Occurs when the upload file progress has changed
File name
File size
Upload progress
Receiver user unified ID.
Receiver user ID
Retry token, can be used for re-sending file.
Upload status
Details in event_chat_file_download_progress
Occurs when the download file progress changes
File Blob, only available when the blob
is set to true
in the downloadFile
method.
File name
File size
File URL
Message ID
Upload progress
Sender user unified ID.
Sender user ID
Upload status
Details in {@link event_smart_summary_change}
Details in {@link event_meeting_query_change}
Occurs when the user is invited to back to the main session.
Inviter user GUID
Inviter user ID
Inviter name
Details in event_subsession_user_update
Occurs when there is a change in the status of users in the subsession.
User's audio state.
Whether the sharer is also sharing the tab audio.
Whether the user started video.
Whether the user is talking.
Whether audio is muted.
Whether the user started sharing.
Subsession ID
Subsession name
User GUID
User ID
Details in event_subsession_broadcast_voice
Occurs when the broadcasted voice's status changes.
Whether the user is receiving the broadcasted voice.
Details in event_crc_device_call_state_change
Occurs when the CRC (Cloud Room Connector) device call state changes.
client.on('crc-call-out-state-change', (payload) => {
console.log(payload.code);
});
CRC call return code
IP address
Protocol
Unique ID for the call
Details in event_current_audio_level_change
Occurs when the current audio volume changes.
Volume level,range from 0 to 9.
Details in event_active_media_failed
Occurs when there is a media internal error, such as an unexpected interruption in media capture or insufficient memory. When receiving this event, we recommend refreshing the page or restarting the browser to resolve the issue. Since the user must do this, we recommend that you provide a popup to guide the user, such as 'We detected an issue with the media stream that we cannot resolve. Please refresh the page to try to fix it.' With two buttons: 'Refresh' and 'Cancel'.
Code
Message
Type
Details in event_video_spotlight_change
Occurs when the host or manager spotlights a user.
client.on('video-spotlight-change', (payload) => {
console.log(payload.spotlightList);
});
spotlighted user list
Details in event_video_screenshot_taken
Occurs when someone in the meeting takes a screenshot of the video
The display name of the user who took the screenshot
The user ID of the user who took the screenshot
Details in event_share_content_screenshot_taken
Occurs when someone in the meeting takes a screenshot of the screen share
The display name of the user who took the screenshot
The user ID of the user who took the screenshot
Reclaims the host privilege if the user is now the host.
Removes the participant.
Revokes the manager permission from the participant.
The video client is the core of the Video SDK.