Adjusts someone's audio locally. This operation doesn't affect other participants' audio.
User ID.
The volume, an integer between 0-100.
The host can set to allow users to unmute themselves.
executed promise.
Enables or disables background suppression.
Note: Enabling this option may increase CPU utilization.
enabled
Enable or disable original sound.
enabled
Enables or disables sync mute or unmute state on headset.
Only supported on Chromium-like browsers.
enabled
Gets the active device ID of the microphone.
Device ID.
Gets the active device of the audio speaker.
Device ID.
Get the audio media file playback controller. Only available when using the media file as an audio source, otherwise, it returns null.
Gets the audio statistic data.
Gets the available microphones.
Microphone list.
Gets the share audio status.
Share audio status.
Gets the available audio speakers.
Speaker list.
Get the user's volume.
User ID.
Number.
Determines whether users are allowed to unmute their audio themselves.
Boolean.
Determines whether the user is muted.
Default undefined
boolean
Determines whether share audio is muted locally. Refers to the audio shared by other participants.
User ID.
Boolean.
Determines whether the platform support microphone audio and share tab audio work at the same time.
boolean.
Determines whether someone's audio is muted locally.
User ID.
Boolean.
Mute all users' audio
// host side
await stream.muteAllAudio();
// other user side
client.on('current-audio-change',payload=>{
if(payload.action==='muted' && payload.source==='passive(mute all)'){
console.log('host muted all');
}
})
executed promise.
Mute all users' audio locally, this operation doesn't affect other users' audio
Mutes audio.
userId
is not specified, this will mute self.Default undefined
.
Executed promise.
The host can set to mute users when they start audio.
boolean default true
executed promise.
Mutes self share audio or other's share audio locally.
If userId
is empty, will mute share audio. Other participants will not be able to hear the share audio.
If userId
is set, will mute share audio locally, other participants are not affected.
Optional empty value will mute self share audio.
Executed promise.
Mutes someone's audio locally. This operation doesn't affect other participants' audio.
User ID.
''
: Success.Error
: Failure. Details in ErrorTypes.Joins audio by microphone and speaker.
await client.init();
await client.join(topic, signature, username, password);
const stream = client.getMediaStream();
await stream.startAudio();
Executed promise. Possible error reasons:
INSUFFICIENT_PRIVILEGES
,reason = AUDIO_CAPTURE_FAILED
: The user has blocked accesses to the microphone from the SDK. Try to grant the privilege and rejoin the session.Start audio with the secondary microphone. This is typically used when a user needs to share additional audio input after joining the audio. Please note that simultaneous screen sharing is not supported in this scenario.
audio track contraints
Leaves computer audio.
Executed promise.
Stop secondary audio
Subscribes to audio statistic data based on the type parameter. Client will receive audio quality data every second.
Note If type is not specified, this will subscribe to both encode and decode audio statistics.
Example
try{
await stream.subscribeAudioStatisticData();
} catch (error) {
console.log(error);
}
Optional. Object { encode: Boolean, decode: Boolean }
can specify which type of audio to subscribe to.
''
: Success.Error
: Failure. Details in ErrorTypes.Switches the microphone.
const microphones = stream.getMicList();
const microphone = // choose another microphone
await switchMicrophone(microphone.deviceId);
Device ID of the microphone or an audio playback file.
Executed promise.
Switches the audio speaker.
Device ID of the speaker.
Executed promise.
Unmute all users' audio
executed promise.
Unute all users' audio locally, this operation doesn't affect other users' audio
Unmutes audio.
userId
is not specified, this will unmute self.// unmute myself
await stream.unmuteAudio();
// host unmute others
await stream.unmuteAudio(userId);
// participant side
client.on('host-ask-unmute-audio',(payload)=>{
console.log('Host ask me to unmute');
})
Default undefined
.
Executed promise.
Unmutes self share audio or other's share audio locally.
If userId
is empty, will unmute share audio, other participants will be able to hear the share audio.
If userId
is set, will unmute share audio locally, other participants are not affected.
Optional empty value will unmute self share audio.
Executed promise.
Unmutes someone's audio locally. This operation doesn't affect other participants' audio.
User ID.
''
: Success.Error
: Failure. Details in ErrorTypes.Unsubscribes to audio statistic data based on the type parameter.
Note If type is not specified, this will unsubscribe to both encode and decode audio statistics. Example
try{
await stream.unsubscribeAudioStatisticData();
} catch (error) {
console.log(error);
}
Optional. Object { encode: Boolean, decode: Boolean }
can specify which type of audio to unsubscribe to.
''
: Success.Error
: Failure. Details in ErrorTypes.Call out CRC (Cloud Room Connector) device
client.on('crc-call-out-state-change',(payload)=>{
console.log('crc device call out status:',payload.code)
})
IP Address
Protocol H323|SIP
Cancel the CRC (Cloud Room Connector) call out request before it is complete.
IP Address
Protocol H323|SIP
Approves the control request.
the requesting user ID.
''
: SuccessError
: Failure. Details in ErrorTypes.Controls the local camera.
The cmd option.
''
: SuccessError
: Failure. Details in ErrorTypes.Controls the far-end camera.
The cmd option.
''
: SuccessError
: Failure. Details in ErrorTypes.Declines the control request.
The requesting user ID.
''
: SuccessError
: Failure. Details in ErrorTypes.Gets the capability of the camera on current device.
Default is active camera ID.
Gets the capability of the far-end camera.
Gives up control of far end camera.
The controlling user ID.
''
: SuccessError
: Failure. Details in ErrorTypes.Determines whether the current browser supports Pan-Tilt-Zoom (PTZ).
Request control on far-end PTZ camera
// UserA
// request control of UserB's camera
stream.requestFarEndCameraControl(userBId);
// UserB
client.on("far-end-camera-request-control", (payload) => {
const { userId, displayName } = payload;
// popup a confirm window, approve or decline the request
stream.approveFarEndCameraControl(userId);
});
// UserA
let isFarEndCameraApproved = false;
let capability = undefined;
client.on("far-end-camera-response-control", (payload) => {
const { isApproved, userId, displayName } = payload;
isFarEndCameraApproved = isApproved;
});
client.on("far-end-camera-capability-change", (payload) => {
const { userId, ptz } = payload;
capability = ptz;
if (capability.pan) {
// pan the camera left
stream.controlFarEndCamera({
userId,
cmd: CameraControlCmd.Left,
range: 10,
});
}
});
the controlling user ID.
''
: SuccessError
: Failure. Details in ErrorTypes.Cancels the dial out request before it is complete.
Country code.
Phone number.
Executed promise.
Get call in info
Gets phone call status.
Phone call status.
Get supported countries.
Supported phone call countries.
Hangs up the phone. Only used when the current audio was joined by phone.
Executed promise.
Invites a user to join by phone.
You can join a Zoom session by means of teleconferencing or audio conferencing (using a traditional phone). This is useful when:
If a number is not listed or has asterisks (***) in place of some of the numbers, it means that number is not available on the account that you're currently logged into.
Check the stream.getSupportCountryInfo()
method to get available countries.
dialout-state-change
event, add a listener to get the latest value.const countryCode = '+1'
const phoneNumber ='8801'
if(stream.getSupportCountryInfo().findIndex(country=>country.code===countryCode)>-1){
await stream.inviteByPhone(countryCode,phoneNumber,name);
}
client.on('dialout-state-change',({code})=>{
console.log('dial out stats:',code);
});
Country code.
Phone number.
Name.
Executed promise.
Determines whether the phone call feature is supported.
Boolean.
Add the processor to the current media stream.
required. The processor instance you want to add.
''
: SuccessCreate a processor.
Required. Processor parameters.
Processor
: Processor instance.Determines whether the current platform supports the video processor.
Whether the current platform supports the video processor.
Remove the current media stream processor.
required. The processor instance you want to remove.
''
: SuccessEnables or disables video share optimization.
boolean
Executed promise.
Gets the user ID of the received shared content.
Active shared user ID.
Gets the share privilege.
Share privilege.
Gets the share statistic data.
data of video statistic.VideoQosData
Receiving share statistic data.
Sending share statistic data.
Gets the status of share.
Share status.
Get the active share stream settings
{@link MediaTrackSettings}
Gets the list of users who are screen sharing.
shared user list
Determines whether the host locked the share.
Whether screen share is locked.
Determines whether to use video element to start screen sharing.
boolean
Determines whether the current platform supports video share.
Locks the privilege of screen share. Only the host or manager can share.
// host
stream.lockShare(true);
// sharing user
client.on('passively-stop-share',payload=>{
if(payload.reason==='PrivilegeChange'){
console.log('passively stop share because of privilege change')
}
})
Set to true
to lock share, or false
to unlock.
Executed promise.
Pauses screen share.
Executed promise.
Resumes screen share.
Executed promise.
Take a screenshot of the share view.
Error
: Failure. Details in ErrorTypes.Sets the privilege of screen share.
The privilege
Executed promise.
Determines whether the shared content is broadcast to subsessions, when screen sharing is started. Available to host or manager.
Executed promise.
Starts screen share.
Required. The canvas which renders the screen share content.
Optional options for screen share.
Executed promise.
Renders the received screen share content.
active-share-change
callback.client.on('active-share-change',payload=>{
if(payload.state==='Active'){
stream.startShareView(canvas,payload.activeUserId);
}else if(payload.state==='Inactive'){
stream.stopShareView();
}
})
Required. The canvas to render the share content.
Required. Active share user ID.
Executed promise.
Stops screen share.
Executed promise.
Stops broadcasting the shared content to subsessions.
Executed promise.
Stops rendering received screen share content.
Executed promise.
Subscribes to share statistic data base on the type parameter. Client will receive video quality data every second.
optional. Object { encode: Boolean, decode: Boolean }, Can specify which type of share to subscribe to.
''
: Success.Error
: Failure. Details in ErrorTypes.Switch to another share content.
When there are multiple users sharing the screen in the session,you can have a chance to switch to another one's screen.
const sharingUserList = stream.getShareUserList();
// click handler of sharing user list menu
switchButton.addEventListener('click',(event)=>{
if(event.dataId!==stream.getActiveShareUserId()){
stream.switchShareView(event.dataId);
}
})
Required. Active share user ID.
Executed promise.
Switches camera for sharing.
Camera ID.
Executed promise.
Unsubscribes to share statistic data bases on the parameter type.
''
: Success.Error
: Failure. Details in ErrorTypes.Updates the share quality when video share enabled. Note: High resolution will lead to low FPS.
Quality.
Executed promise.
Sets the dimension of the canvas rendering the received share content.
Canvas width.
Canvas height.
Executed promise.
Adjusts the coordinates and dimension of the rendered video.
Required. The canvas to render the video.
Required. The user ID which to render the video.
Optional. Video width. undefined
if the canvas parameter is a video tag
Optional. Video height. undefined
if the canvas parameter is a video tag
Optional. Coordinate x of video. undefined
if the canvas parameter is a video tag
Optional. Coordinate y of video. undefined
if the canvas parameter is a video tag
Optional. Must be paired with renderVideo
.
''
: Success.Error
: Failure. Details in ErrorTypes.Create a VideoPlayer or reuse the existing VideoPlayer and attach the video stream to it.
Note the returned video-playerVideoPlayer element must be a child node of the video-player-container VideoPlayerContainer.
<video-player-container>
<div class="video-tile"></div>
</video-player-container>
const element = await stream.attachVideo(userId,VideoQuality.Video_720P);
document.querySelector('.video-tile').appendChild(element);
Required. The user ID which to render the video.
Required. Quality of the video. One of the following: 90P/180P/360P/720P/1080P.
Optional. Empty value: create a new element; String value: VideoPlayer element selector specified by document.querySelector; VideoPlayer Element value: Specified element
Clears the canvas.
Required. The canvas to render the video.
Optional. Underlying color when video is stopped. Default is transparent.
''
: Success.Error
: Failure. Details in ErrorTypes.Detach the video stream from all previously attached VideoPlayer elements or specific elements.
const elements = await stream.detachVideo(userId);
if (Array.isArray(elements)) {
elements.forEach((e) => e.remove());
} else {
elements.remove();
}`
Required. The user ID which to render the video.
Optional. Empty value: detach all video streams. String value:VideoPlayer element selector specified by document.querySelector; VideoPlayer Element value: Specified element
Tries to enable hardware acceleration.
boolean or specific encode or decode.
Promise<boolean> true: success, false: fail.
Gets the recently active camera devices ID.
''
: The video flag is false
in media constraints.'default'
: No camera device ID is passed to startCaptureVideo
and it will use system default camera.string
: Recently active camera devices ID.Gets the recently active video ID.
0
: No video is active or the video flag is false
in media constraints.number
: ID of current active video.Gets the current camera devices list.
Note
navigator.mediaDevices
object and maintained by the stream object.CameraDevice
object with all properties set to empty strings.[]
: The video flag is false
in media constraints.Array<CameraDevice>
: A CameraDevice interface has following property:label: string
: The label of camera device.deviceId: string
: The string of camera device.Gets captured video resolution.
Get maximum concurrent video renders supported by current device.
The number of simultaneous video renders, typically affected by GPU/CPU/ShareArrayBuffer capabilities.
Gets network quality. Only the network quality of users who start video is meaningful.
optional, default is current user
Gets the dimension of received video.
Note this is only available when multi-video rendering is not supported.
For the case of multi-video rendering, get each video's resolution from the video-detailed-data-change
event
Received video dimension.
Get a list of spotlighted users.
Gets video mask status.
Gets the maximum quality of video.
Highest video quality. See the definition VideoQuality
Get the video media file playback controller. Only available when using a media file as a video source, otherwise, it returns null.
Gets the video statistic data.
Video statistic date. VideoQosData
Gets the status of the virtual backgrounds.
Status of the virtual background. VirtualBackgroundStatus
Gets the isCameraTaken
flag status.
true
: The camera is taken by another program.false
: The camera is taken by another program or the video flag is false
in media constraints.Gets the isCaptureForbidden
flag status.
true
: The capture is forbidden by the user.false
: The capture is not forbidden by user or the video flag is false
in media constraints.Gets the isCapturingVideo
flag status.
true
: The stream object is capturing video.false
: The stream object is not capturing video or the video flag is false
in media constraints.Determines whether to use video element to render self-view.
Boolean.
Determines whether HD video is supported.
Whether the current account supports sending 720p video.
Determines whether the browser can support multiple videos. If this returns false, we recommend that you render self-view in a separate video-player-container.
Whether the current platform supports multiple videos.
Determines whether the current platform supports virtual backgrounds.
Whether the current platform supports virtual backgrounds.
Whether the self video is mirrored
Mirrors current video.
''
: Success.Error
: Failure. Details in ErrorTypes.Preview the video mask, if the video is on, preview mask will apply to current video.
Mask option.
''
: Success.Error
: Failure. Details in ErrorTypes.Previews the virtual background. If the video is on, preview virtual background applies to the current video.
Virtual background image.
Cropped to 16/9 aspect ratio. Default is false.
cameraId, default is active camera
''
: Success.Error
: Failure. Details in ErrorTypes.Remove all spotlighted videos. Available to host.
''
: Success.Error
: Failure. Details in ErrorTypes.Remove a user's video from being spotlighted.
Optional.
''
: Success.Error
: Failure. Details in ErrorTypes.Required. The canvas or video to render the video. If userId
is the current user and stream.isRenderSelfViewWithVideoElement()
returns true
, you need to use a video tag for rendering.
Required. The user ID which to render the video.
Required. Video width. undefined
if the canvas parameter is a video tag
Required. Video height. undefined
if the canvas parameter is a video tag
** Note **
The origin of the coordinates is in the lower left corner of the canvas.
Required. Coordinate x of video. undefined
if the canvas parameter is a video tag
Required. Coordinate y of video. undefined
if the canvas parameter is a video tag
Required. Video quality: 90p, 180p, 360p, 720p. Currently supports up to 720p.
Optional. Used to render the same video on different coordinates of the canvas.
''
: SuccessError
: Failure. Details in ErrorTypes.Take a screenshot of the specified user's video stream.
Required. The user ID which to screenshot the video.
Error
: Failure. Details in ErrorTypes.Spotlight specific user's video. Available to host or manager.
Note:Spotlighting a video affects the behavior of the
video-active-change
event. The spotlighted user remains the active user, regardless of whether they are speaking. This also impacts the behavior in the recording file; when the 'Record active speaker' option is selected, the recording will always show the spotlighted user's video.
Required. Id of user to spotlight.
Optional. Host can spotlight multiple users, if true, replace all spotlighted users, otherwise, add as a new spotlighted user.
''
: Success.Error
: Failure. Details in ErrorTypes.Starts capturing video from a specified camera.
Note
Example
try {
await stream.startVideo();
} catch (error) {
console.log(error);
}
''
: SuccessError
: Failure. Errors besides ErrorTypes that may be returned include the following:CAN_NOT_DETECT_CAMERA
: Cannot detect camera device.CAN_NOT_FIND_CAMERA
: The provided camera device ID is not included in the camera device list.VIDEO_USER_FORBIDDEN_CAPTURE
: The user has forbidden the use of the camera. They can allow camera and rejoin the session.VIDEO_ESTABLISH_STREAM_ERROR
: Video WebSocket is broken.VIDEO_CAMERA_IS_TAKEN
: User's camera is taken by other programs.Stop previewing the video mask.
''
: Success.Error
: Failure. Details in ErrorTypes.Stops previewing the virtual background.
''
: Success.Error
: Failure. Details in ErrorTypes.Required. The canvas or video to render the video. If userId
is the current user and stream.isRenderSelfViewWithVideoElement()
returns true
, you need to use a video tag for stopping rendering.
Required. The user ID which to render the video.
Optional. Must be paired with renderVideo
.
Optional. Underlying color when video is stopped. Default is transparent.
Optional. Determines whether to keep the last frame when stopping the video.
Optional. Whether to replace the rendered user at the same coordinate position. The benefit of specifying the next user can reduce the gap time between switching two users' videos. Only one user's video can be preloaded at the same time.
''
: Success.Error
: Failure. Details in ErrorTypes.Stops current video capturing.
Example
try{
await stream.stopVideo();
} catch (error) {
console.log(error);
}
''
: SuccessError
: Failure. Details in ErrorTypes.Subscribes to video statistic data based on the type parameter. Client will receive video quality data every second.
Note If type is not specified, this subscribes to both encode and decode video statistics.
Example
try{
await stream.subscribeVideoStatisticData();
} catch (error) {
console.log(error);
}
Optional. Object { encode: Boolean, decode: Boolean }
can specify which type of audio should be subscribed to.
''
: Success.Error
: Failure. Details in ErrorTypes.Changes camera device for capturing video.
Note
Example
try{
const cameras = stream.getCameraList();
const camera = // choose your camera
await stream.switchCamera(camera.deviceId);
} catch (error) {
console.log(error);
}
Camera device ID or a video playback file.
Unsubscribes to video statistic data based on the type parameter.
Note If type is not specified, this will unsubscribe to both encode and decode audio statistics. Example
try{
await stream.unsubscribeVideoStatisticData();
} catch (error) {
console.log(error);
}
Optional. Object { encode: Boolean, decode: Boolean }
can specify which type of audio should be unsubscribed to.
''
: Success.Error
: Failure. Details in ErrorTypes.Updates the dimension of the canvas. Used to update the width or height when the styled width or height changed.
Required. The canvas to render the video.
Required. Canvas's new width.
Update the option of video mask. You can update each option individually.
mask option
''
: Success.Error
: Failure. Details in ErrorTypes.Updates the virtual background image.
Virtual background image.
Cropped to 16/9 aspect ratio. Default is false.
''
: Success.Error
: Failure. Details in ErrorTypes.
The stream interface provides methods that define the behaviors of a stream object, such as mute audio or capture video.
The stream object is created by the
getMediaStream
method.