Options
All
  • Public
  • Public/Protected
  • All
Menu

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.

Index

Audio Functions

Camera Functions

Other Functions

Phone Functions

Screen Share Functions

Video Functions

Audio Functions

adjustUserAudioVolumeLocally

  • adjustUserAudioVolumeLocally(userId: number, volume: number): ExecutedResult
  • Adjust someone's audio locally, this operation doesn't affect other participants' audio

    Parameters

    • userId: number

      userId

    • volume: number

      number

    Returns ExecutedResult

getActiveMicrophone

  • getActiveMicrophone(): string
  • Gets the active device ID of the microphone.

    Returns string

    Device ID.

getActiveSpeaker

  • getActiveSpeaker(): string
  • Gets the active device of the speaker.

    Returns string

    Device ID.

getAudioStatisticData

  • getAudioStatisticData(): {}

getMicList

  • Gets the available microphones.

    Returns MediaDevice[]

    Microphone list.

getShareAudioStatus

getSpeakerList

  • Gets the available speakers.

    Returns MediaDevice[]

    Speaker list.

getUserVolumeLocally

  • getUserVolumeLocally(userId: number): number
  • Get the user's volume.

    Parameters

    • userId: number

      User ID.

    Returns number

    Number.

isAudioMuted

  • isAudioMuted(userId?: number): boolean
  • Determines whether the user is muted.

    • If the user ID is not specified, gets the muted status of the current user.

    Parameters

    • Optional userId: number

      Default undefined

    Returns boolean

    boolean

isOthersShareAudioMutedLocally

  • isOthersShareAudioMutedLocally(userId: number): boolean
  • Determines whether share audio is muted locally. Refers to the audio shared by other participants.

    Parameters

    • userId: number

      User ID.

    Returns boolean

    Boolean.

isUserAudioMutedLocally

  • isUserAudioMutedLocally(userId: number): boolean
  • Determines whether someone's audio is muted locally.

    Parameters

    • userId: number

      User ID.

    Returns boolean

    Boolean.

muteAudio

  • Mutes audio.

    • If userId is not specified, this will mute self.
    • Only the host or manager can mute others.
    • If a participant is allowed to talk, the host can also mute them.

    Parameters

    • Optional userId: number

      Default undefined.

    Returns ExecutedResult

    Executed promise.

muteShareAudio

  • 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.

    Parameters

    • Optional userId: number

      Optional empty value will mute self share audio.

    Returns ExecutedResult

    Executed promise.

muteUserAudioLocally

  • Mutes someone's audio locally. This operation doesn't affect other participants' audio.

    Parameters

    • userId: number

      User ID.

    Returns ExecutedResult

      • '': Success.

startAudio

  • Joins audio by microphone and speaker.

    • If the participant has joined audio by phone, they cannot join using computer audio.
    await client.init();
    await client.join(topic, signature, username, password);
    const stream = client.getMediaStream();
    await stream.startAudio();
    

    Safari browser is different:

    let audioDecode, audioEncode;
    // wait until the encoding and decoding process is ready for the audio
    client.on("media-sdk-change", (payload) => {
       const { action, type, result } = payload;
       if (type === "audio" && result === "success") {
         if (action === "encode") {
           audioEncode = true;
         } else if (action === "decode") {
           audioDecode = true;
         }
         if (audioDecode && audioEncode) {
           try {
             // start audio automatically in Safari
             stream.startAudio({ autoStartAudioInSafari: true });
           } catch (err) {
             console.warn(err);
           }
         }
       }
     });
    
     // Start audio in 'click' callback in Safari
     joinAudioButton.addEventListener("click", () => {
       if (audioDecode && audioDecode) {
         try {
           stream.startAudio();
         } catch (err) {
            console.warn(err);
         }
       }
     });
    
    

    Parameters

    Returns ExecutedResult

    Executed promise. Following are the possible error reasons:

    • type=USER_FORBIDDEN_MICROPHONE: The user has blocked accesses to the microphone from the SDK. Try to grant the privilege and rejoin the session.

stopAudio

subscribeAudioStatisticData

  • 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.

    • Client only handles the encode (send) audio statistic data when:
      1. Current user's audio is connected.
      2. Current user is not muted.
      3. There is another participant who is listening to the current user's audio.
    • Client only handles the decode (receive) audio statistic data when:
      1. Current user's audio is connected.
      2. There is another participant who is sending audio.

    Example

    try{
      await stream.subscribeAudioStatisticData();
    } catch (error)  {
      console.log(error);
    }
    

    Parameters

    • Optional type: AudioStatisticOption

      Optional. Object { encode: Boolean, decode: Boolean } can specify which type of audio to subscribe to.

    Returns ExecutedResult

    • '': Success.
    • Error: Failure. Details in ErrorTypes.

switchMicrophone

  • Switches the microphone.

     const microphones = stream.getMicList();
     const microphone = // choose another microphone
     await switchMicrophone(microphone.deviceId);
    

    Parameters

    • microphoneId: string

      Device ID of the microphone.

    Returns ExecutedResult

    Executed promise.

switchSpeaker

  • Switches the speaker.

    Parameters

    • speakerId: string

      Device ID of the speaker.

    Returns ExecutedResult

    Executed promise.

unmuteAudio

  • Unmute audio.

    • If userId is not specified, this will unmute self.
    • For privacy and security concerns, the host can not unmute the participant's audio directly, instead, the participant will receive an unmute audio consent message.
    // 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');
    })
    

    Parameters

    • Optional userId: number

      Default undefined.

    Returns ExecutedResult

    Executed promise.

unmuteShareAudio

  • 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.

    Parameters

    • Optional userId: number

      Optional empty value will unmute self share audio.

    Returns ExecutedResult

    Executed promise.

unmuteUserAudioLocally

  • Unmutes someone's audio locally. This operation doesn't affect other participants' audio.

    Parameters

    • userId: number

      User ID.

    Returns ExecutedResult

      • '': Success.

unsubscribeAudioStatisticData

  • 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);
    }
    

    Parameters

    • Optional type: AudioStatisticOption

      Optional. Object { encode: Boolean, decode: Boolean } can specify which type of audio to unsubscribe to.

    Returns ExecutedResult

      • '': Success.

Camera Functions

approveFarEndCameraControl

  • Approve the control request.

    Parameters

    • userId: number

      the requesting user ID.

    Returns ExecutedResult

    • '': Success
    • Error: Failure. Details in ErrorTypes.

controlCamera

controlFarEndCamera

declineFarEndCameraControl

  • Decline the control request.

    Parameters

    • userId: number

      The requesting user ID.

    Returns ExecutedResult

    • '': Success
    • Error: Failure. Details in ErrorTypes.

getCameraPTZCapability

  • Get the capability of the camera on current device

    Parameters

    • Optional cameraId: string

      default is active camera id

    Returns PTZCameraCapability

getFarEndCameraPTZCapability

  • Get the capability of the far-end camera.

    Parameters

    • userId: number

    Returns PTZCameraCapability

giveUpFarEndCameraControl

  • Give up control of far end camera.

    Parameters

    • userId: number

      The controlling user ID.

    Returns ExecutedResult

    • '': Success
    • Error: Failure. Details in ErrorTypes.

requestFarEndCameraControl

  • 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,
        });
      }
    });
    

    Parameters

    • userId: number

      the controlling user ID.

    Returns ExecutedResult

    • '': Success
    • Error: Failure. Details in ErrorTypes.

Other Functions

isBrowserSupportPTZ

  • isBrowserSupportPTZ(): boolean
  • Determined whether current browser support PTZ function

    Returns boolean

Phone Functions

cancelInviteByPhone

  • cancelInviteByPhone(countryCode: string, phoneNumber: string, options?: {}): ExecutedResult
  • Cancels the dial out request before it is complete.

    Parameters

    • countryCode: string

      Country code.

    • phoneNumber: string

      Phone number.

    • Optional options: {}

    Returns ExecutedResult

    Executed promise.

getInviteByPhoneStatus

  • Gets phone call status.

    Returns DialoutState

    Phone call status.

getSupportCountryInfo

  • Get supported countries.

    Returns PhoneCallCountry[]

    Supported phone call countries.

hangup

  • Hangs up the phone. Only used when the current audio was joined by phone.

    Returns ExecutedResult

    Executed promise.

inviteByPhone

  • 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:

    • You do not have a microphone or speaker on your PC or macOS machine.
    • You do not have a smartphone (iOS or Android) while on the road.
    • You cannot connect to a network for video and VoIP (computer audio).

    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.

    • This method will trigger the 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);
      });
      

    Parameters

    • countryCode: string

      Country code.

    • phoneNumber: string

      Phone number.

    • name: string

      Name.

    • Optional options: DialOutOption

    Returns ExecutedResult

    Executed promise.

isSupportPhoneFeature

  • isSupportPhoneFeature(): boolean
  • Determines whether the phone call feature is supported.

    Returns boolean

    Boolean.

Screen Share Functions

getActiveShareUserId

  • getActiveShareUserId(): number
  • Gets the user ID of the received shared content.

    Returns number

    Active shared user ID.

getSharePrivilege

getShareStatus

  • Gets the status of share.

    Returns ShareStatus

    Share status.

getShareUserList

  • Get the list of users who are screen sharing.

    Returns Participant[]

    shared user list

isShareLocked

  • isShareLocked(): boolean
  • Determines whether the host locked the share.

    Returns boolean

    Whether screen share is locked.

isStartShareScreenWithVideoElement

  • isStartShareScreenWithVideoElement(): boolean
  • Whether to use video element to start screen sharing.

    Returns boolean

    boolean

lockShare

  • Locks the privilege of screen share. Only the host or manager can share.

    • Only the host or manager has the permission.
    • If a participant (non-host or manager) is sharing the screen, once the host locks screen share, their share will be forcibly stopped.
    // 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')
     }
    })
    

    Parameters

    • isLocked: boolean

      Set to true to lock share, or false to unlock.

    Returns ExecutedResult

    Executed promise.

pauseShareScreen

resumeShareScreen

setSharePrivilege

shareToSubsession

  • When screen sharing is started, host or manager can determine whether the shared content is broadcast to subsessions.

    Returns ExecutedResult

    Executed promise.

startShareScreen

  • Starts screen share.

    • Check the share privilege before starting screen share.
    • If you start screen share, you will stop receiving others' shared content.
    • Users with legacy Chrome browsers need to install a chrome extension before starting screen share. Check the promise return value.

    Parameters

    • canvas: HTMLCanvasElement

      Required. The canvas which renders the screen share content.

    • Optional options: ScreenShareOption

      Optional options for screen share.

    Returns ExecutedResult

    Executed promise.

    • {type:'INVALID_OPERATION', reason:'required extension', extensionUrl:'url'} : Install the extension before starting share.

startShareView

  • startShareView(canvas: HTMLCanvasElement, activeUserId: number): ExecutedResult
  • Renders the received screen share content.

    • It is usually called in the 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();
     }
    })
    

    Parameters

    • canvas: HTMLCanvasElement

      Required. The canvas to render the share content.

    • activeUserId: number

      Required. Active share user ID.

    Returns ExecutedResult

    Executed promise.

stopShareScreen

stopShareToSubsession

  • Stop broadcasting the shared content to subsessions.

    Returns ExecutedResult

    Executed promise.

stopShareView

  • Stops rendering received screen share content.

    Returns ExecutedResult

    Executed promise.

switchShareView

  • 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);
     }
    })
    
    

    Parameters

    • activeNodeId: number

      Required. Active share user ID.

    Returns ExecutedResult

    Executed promise.

switchSharingSecondaryCamera

  • Switch camera for sharing.

    Parameters

    • cameraId: string

      Camera ID.

    Returns ExecutedResult

    Executed promise.

updateSharingCanvasDimension

  • updateSharingCanvasDimension(width: number, height: number): ExecutedResult
  • Sets the dimension of the canvas rendering the received share content.

    Parameters

    • width: number

      Canvas width.

    • height: number

      Canvas height.

    Returns ExecutedResult

    Executed promise.

Video Functions

adjustRenderedVideoPosition

  • adjustRenderedVideoPosition(canvas: HTMLCanvasElement, userId: number, width: number, height: number, x: number, y: number, additionalUserKey?: string): ExecutedResult
  • Adjusts the coordinates and dimension of the rendered video.

    Parameters

    • canvas: HTMLCanvasElement

      Required. The canvas to render the video.

    • userId: number

      Required. The user ID which to render the video.

    • width: number

      Required. Video width.

    • height: number

      Required. Video height.

    • x: number

      Required. Coordinate x of video.

    • y: number

      Required. Coordinate y of video.

    • Optional additionalUserKey: string

      Optional. Must be paired with renderVideo.

    Returns ExecutedResult

    • '': Success.
    • Error: Failure. Details in ErrorTypes.

clearVideoCanvas

  • Clears the canvas.

    Parameters

    • canvas: HTMLCanvasElement

      Required. The canvas to render the video.

    • Optional underlyingColor: UnderlyingColor | string

      Optional. Underlying color when video is stopped. Default is transparent.

      • @returns
      • '': Success.
      • Error: Failure. Details in ErrorTypes.

    Returns ExecutedResult

enableHardwareAcceleration

  • enableHardwareAcceleration(enable: boolean | {}): Promise<boolean>
  • Tries to enable hardware acceleration.

    Parameters

    • enable: boolean | {}

      boolean or specific encode or decode.

    Returns Promise<boolean>

    Promise<boolean> true: success, false: fail.

getActiveCamera

  • getActiveCamera(): string
  • Gets the recently active camera devices ID.

    Returns string

    • '': 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.

getActiveVideoId

  • getActiveVideoId(): number
  • Gets the recently active video ID.

    Returns number

    • 0: No video is active or the video flag is false in media constraints.
    • number: ID of current active video.

getCameraList

  • Gets the current camera devices list.

    Note

    • This camera device list is collected from the browser's navigator.mediaDevices object and maintained by the stream object.
    • If the user does not allow permission to access the camera, this list will have a default CameraDevice object with all properties set to empty strings.

    Returns MediaDevice[]

    • []: 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.

getNetworkQuality

  • Get network quality,only the network quality of users who start video is meaningful.

    Parameters

    • Optional userId: number

      optional, default is current user

    Returns NetworkQuality

getReceivedVideoDimension

  • getReceivedVideoDimension(): {}
  • Gets the dimension of received video.

    Returns {}

    Received video dimension.

getVideoMaxQuality

  • getVideoMaxQuality(): number
  • Gets the maximum quality of video.

    Returns number

    Highest video quality. See the definition VideoQuality

getVideoStatisticData

  • getVideoStatisticData(): {}
  • Gets the video statistic data.

    Returns {}

    Video statistic date. VideoQosData

getVirtualbackgroundStatus

isCameraTaken

  • isCameraTaken(): boolean
  • Gets the isCameraTaken flag status.

    Returns boolean

    • 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.

isCaptureForbidden

  • isCaptureForbidden(): boolean
  • Gets the isCaptureForbidden flag status.

    Returns boolean

    • 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.

isCapturingVideo

  • isCapturingVideo(): boolean
  • Gets the isCapturingVideo flag status.

    Returns boolean

    • true: The stream object is capturing video.
    • false: The stream object is not capturing video or the video flag is false in media constraints.

isRenderSelfViewWithVideoElement

  • isRenderSelfViewWithVideoElement(): boolean
  • Whether to use video element to render self-view.

    Returns boolean

    Boolean.

isSupportHDVideo

  • isSupportHDVideo(): boolean
  • Determines whether HD video is supported.

    Returns boolean

    Whether the current account supports sending 720p video.

isSupportMultipleVideos

  • isSupportMultipleVideos(): boolean
  • Determines whether the browser can support multiple videos.

    Returns boolean

    Whether the current platform supports multiple videos.

isSupportVirtualBackground

  • isSupportVirtualBackground(): boolean
  • Determines whether the current platform supports virtual backgrounds.

    Returns boolean

    Whether the current platform supports virtual backgrounds.

mirrorVideo

  • Mirrors current video.

    Parameters

    • mirrored: boolean

    Returns ExecutedResult

    • '': Success.
    • Error: Failure. Details in ErrorTypes.

previewVirtualBackground

  • previewVirtualBackground(canvas: HTMLCanvasElement, imageUrl: string | "blur" | undefined, cropped?: boolean): ExecutedResult
  • Previews the virtual background. If the video is on, preview virtual background applies to the current video.

    Parameters

    • canvas: HTMLCanvasElement
    • imageUrl: string | "blur" | undefined

      Virtual background image.

    • Optional cropped: boolean

      Cropped to 16/9 aspect ratio. Default is false.

    Returns ExecutedResult

    • '': Success.
    • Error: Failure. Details in ErrorTypes.

renderVideo

  • renderVideo(canvas: HTMLCanvasElement, userId: number, width: number, height: number, x: number, y: number, videoQuality: VideoQuality, additionalUserKey?: string): Promise<"" | Error>
  • Starts rendering video.

    Example

    try{
      const canvas = document.querySelector('#canvas-id');
      await stream.renderVideo(canvas,userId,300,200,0,0,1);
    } catch (error)  {
      console.log(error);
    }
    

    Parameters

    • canvas: HTMLCanvasElement

      Required. The canvas to render the video.

    • userId: number

      Required. The user ID which to render the video.

    • width: number

      Required. Video width.

    • height: number

      Required. Video height.

      ** Note **

      The origin of the coordinates is in the lower left corner of the canvas.

    • x: number

      Required. Coordinate x of video.

    • y: number

      Required. Coordinate y of video.

    • videoQuality: VideoQuality

      Required. Video quality: 90p, 180p, 360p, 720p. Currently supports up to 720p.

    • Optional additionalUserKey: string

      Optional. Used to render the same video on different coordinates of the canvas.

    Returns Promise<"" | Error>

    • '': Success
    • Error: Failure. Details in ErrorTypes.

startVideo

  • Starts capturing video from a specified camera.

    Note

    • It may take the user some time to allow browser access to the camera device. Therefore there is no default timeout.

    Example

    try {
      await stream.startVideo();
    } catch (error) {
      console.log(error);
    }
    

    Parameters

    Returns ExecutedResult

    • '': Success
    • Error: 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.

stopPreviewVirtualBackground

stopRenderVideo

  • stopRenderVideo(canvas: HTMLCanvasElement, userId: number, additionalUserKey?: string, underlyingColor?: UnderlyingColor | string, isKeepLastFrame?: boolean): ExecutedResult
  • Stops rendering the video.

    Example

    try{
      await stream.stopRenderVideo();
    } catch (error)  {
      console.log(error);
    }
    

    Parameters

    • canvas: HTMLCanvasElement

      Required. The canvas to render the video.

    • userId: number

      Required. The user ID which to render the video.

    • Optional additionalUserKey: string

      Optional. Must be paired with renderVideo.

    • Optional underlyingColor: UnderlyingColor | string

      Optional. Underlying color when video is stopped. Default is transparent.

    • Optional isKeepLastFrame: boolean

      Optional. Determines whether to keep the last frame when stopping the video.

    Returns ExecutedResult

    • '': Success.
    • Error: Failure. Details in ErrorTypes.

stopVideo

  • Stops current video capturing.

    Example

    try{
      await stream.stopVideo();
    } catch (error) {
      console.log(error);
    }
    

    Returns ExecutedResult

    • '': Success
    • Error: Failure. Details in ErrorTypes.

subscribeVideoStatisticData

  • 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.

    • Client only handles the encode (send) video statistic data when:
        1. Current user turns on video.
        1. There is other participant watching the current user's video.
    • Client only handles the decode (receive) video statistic data when:
        1. There is other participant sending video.

    Example

    try{
      await stream.subscribeVideoStatisticData();
    } catch (error)  {
      console.log(error);
    }
    

    Parameters

    • Optional type: VideoStatisticOption

      Optional. Object { encode: Boolean, decode: Boolean } can specify which type of audio should be subscribed to.

    Returns ExecutedResult

    • '': Success.
    • Error: Failure. Details in ErrorTypes.

switchCamera

  • Changes camera device for capturing video.

    Note

    • The camera device ID is accessible only after the user allows the browser to access camera devices.
    • If the using on the mobile devices, using the MobileVideoFacingMode as the camera ID.

    Example

    try{
      const cameras = stream.getCameraList();
      const camera =  // choose your camera
      await stream.switchCamera(camera.deviceId);
    } catch (error) {
      console.log(error);
    }
    

    Parameters

    Returns ExecutedResult

unsubscribeVideoStatisticData

  • 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);
    }
    

    Parameters

    • Optional type: VideoStatisticOption

      Optional. Object { encode: Boolean, decode: Boolean } can specify which type of audio should be unsubscribed to.

    Returns ExecutedResult

    • '': Success.
    • Error: Failure. Details in ErrorTypes.

updateVideoCanvasDimension

  • updateVideoCanvasDimension(canvas: HTMLCanvasElement, width: number, height: number): ExecutedResult
  • Updates the dimension of the canvas. Used to update the width or height when the styled width or height changed.

    Parameters

    • canvas: HTMLCanvasElement

      Required. The canvas to render the video.

    • width: number

      Required. Canvas's new width.

    • height: number

      Required. Canvas's new height.

      • @returns
      • '': Success.
      • Error: Failure. Details in ErrorTypes.

    Returns ExecutedResult

updateVirtualBackgroundImage

  • updateVirtualBackgroundImage(imageUrl: string | "blur" | undefined, cropped?: boolean): ExecutedResult
  • Updates the virtual background image.

    Parameters

    • imageUrl: string | "blur" | undefined

      Virtual background image.

    • Optional cropped: boolean

      Cropped to 16/9 aspect ratio. Default is false.

    Returns ExecutedResult

    • '': Success.
    • Error: Failure. Details in ErrorTypes.