Adjust the coordinates and dimension of rendered video.
Required. The canvas to render the video.
Required. The user id which to render the video.
Required. Width of the video.
Required. Height of the video.
Required. Coordinate x of video.
Required. Coordinate y of video.
Optional. Must be paired with renderVideo
.
''
: Success.Error
: Failure. Details in ErrorTypes.Clear all the canvas
Required. The canvas to render the video.
Optional. Underlying color when video is stopped,default is transparent.
Get the recently active camera devices id.
Example
try{
const activeCamera = stream.getActiveCamera();
console.log(activeCamera);
} catch (error) {
console.log(error);
}
''
: The video flag is false
in media constraints.'default'
: No camera device id is passed to startVideo
and it will use system default camera.string
: Recently active camera devices id.Get the active device id of microphone.
device id
Get the user id of received shared content
Get the active device of speaker.
device id
Get the recently active video id.
Example
try{
const activeVideoId = stream.getActiveVideoId();
console.log(activeVideoId);
} catch (error) {
console.log(error);
}
0
: No video is active or the video flag is false
in media constraints.number
: Id of current active video.Get the current camera devices list.
Note
Example
try{
const currentCameraDevicesList = stream.getCameraList();
console.log(currentCameraDevicesList);
} catch (error) {
console.log(error);
}
[]
: 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.Get the available microphones.
Get the dimension of received video.
Get the available speakers.
Get the max quality of video.
Whether the user is muted.
Default undefined
boolean
Get the isCameraTaken flag status.
Example
try{
const isCameraTaken = stream.isCameraTaken();
console.log(isCameraTaken);
} catch (error) {
console.log(error);
}
true
: The camera is taken by other program.false
: The camera is taken by other program.Get the isCaptureForbidden flag status.
Example
try{
const isCaptureForbidden = stream.isCaptureForbidden();
console.log(isCaptureForbidden);
} catch (error) {
console.log(error);
}
None.
true
: The capture is forbidden by user.false
: The capture is not forbidden by user or the video flag is false
in media constraints.Get the isCapturingVideo flag status.
Example
try{
const isCapturingVideo = stream.isCapturingVideo();
console.log(isCapturingVideo);
} catch (error) {
console.log(error);
}
true
: The stream object is capturing video.false
: The stream object is not capturing video.Whether the host locked the share
Lock the privilege of screen share, only the host(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 true to lock share, or false to unlock.
Mute audio
Default undefined
Pause screen share
Start render video
Note
true
in media constraints.Example
try{
const canvas = document.querySelector('#canvas-id');
await stream.renderVideo(canvas,userId,300,200,0,0,1);
} catch (error) {
console.log(error);
}
Required. The canvas to render the video.
Required. The user id which to render the video.
Required. Width of the video.
Required. Height of the video.
** Note **
The origin of the coordinates is in the lower left corner of the canvas
Required. Coordinate x of video.
Required. Coordinate y of video.
Required. Quality of the video. 90P/180P/360P/720P. Currently supports up to 360P
Optional. Used for render the same video on different coordinate of the canvas.
''
: SuccessError
: Failure. Deatils in ErrorTypes.Resume screen share
Join audio by the microphone and speaker.
true
in the media constraints.await client.init();
await client.join(topic, signature, username, password);
const stream = client.getMediaStream();
await stream.startAudio();
executed promise. Following are the possible error reasons:
USER_FORBIDDEN_MICROPHONE
: The user has blocked accesses to the microphone from the sdk, try to grant the privilege and rejoin the meeting.Start screen share.
Required. The canvas which renders the screen share content.
executed promise.
Render the received screen share content.
active-share-change
callback.client.on('active-share-change',payload=>{
if(payload.state==='Active'){
stream.startShareView(payload.activeUserId,canvas);
}else if(payload.state==='Inactive'){
stream.stopShareView();
}
})
Required. the canvas to render the share content
Required. active share user id
executed promise.
Start capture video by a specified camera.
Note
Example
try{
const canvas = ['capture-canvas-1', 'capture-canvas-2'];
const video = 'capture-video';
await stream.startVideo(canvas, video);
} catch (error) {
console.log(error);
}
''
: SuccessError
: Failure. Errors besides ErrorTypes that may be returned are listed below.CAN_NOT_DETECT_CAMERA
: Cannot detect camera device.CAN_NOT_FIND_CAMERA
: The provided camera device id is not included in camera device list.VIDEO_USER_FORBIDDEN_CAPTURE
: The user has forbidden use camera, he/she can allow camera and rejoin the meeting.VIDEO_ESTABLISH_STREAM_ERROR
: Video websocket is broken.VIDEO_CAMERA_IS_TAKEN
: User's camera is taken by other programs.Leave the computer audio
true
in the media constraints.Stop render the video.
Note
true
in media constraints.Example
try{
await stream.stopRenderVideo();
} catch (error) {
console.log(error);
}
Required. The canvas to render the video.
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. Whether keep the last frame when stop the video.
''
: Success.Error
: Failure. Details in ErrorTypes.Stop screen share
Stop render received screen share content.
executed promise.
Stop current video capturing.
Example
try{
await stream.stopVideo();
} catch (error) {
console.log(error);
}
''
: SuccessError
: Failure. Details in ErrorTypes.Change camera device for capturing video.
Note
Example
try{
const newCameraDeviceId = stream.getCameraList()[0];
await stream.switchCamera(newCameraDeviceId);
} catch (error) {
console.log(error);
}
The id of camera device.
Switch the microphone
const microphones = stream.getMicList();
const microphone = microphones.length>0 && microphones[0];
await switchMicrophone(microphone);
the device id of microphone
Switch the speaker
the device id of speaker
Unmute audio
// unmute myself
if(stream.isAllowToUnmute()){
await stream.unmuteAudio();
}
// host unmute others
await stream.unmuteAudio(userId);
// participant side
client.on('unmute-audio-consent',(payload)=>{
console.log('Host ask me to unmute');
})
Default undefined
Update the dimension of the canvas Used to update the width/height when the styed width/height changed.
Required. The canvas to render the video.
Required. New width of canvas
Required. New height of canvas
''
: Success.Error
: Failure. Details in ErrorTypes.Generated using TypeDoc
The Stream interface provides methods that define the behaviors of a Stream object, such as the mute audio, capture video.
The Stream object is created by the
getMediaStream
method..