Javascript API Reference
    Preparing search index...

    Class Participant

    Index

    Constructors

    Properties

    displayName: string

    This represents display name of the participant.

    id: string

    This represents unique ID of the participant who joined the meeting.

    local: boolean

    This indicates whether this participant is the local user.

    • true → Local participant (you)
    • false → Remote participant
    metaData: object

    This represents participant's metadata provided while initializing the meeting

    micOn: boolean

    This indicates whether the participant’s microphone is currently enabled.

    mode: "SEND_AND_RECV" | "SIGNALLING_ONLY" | "RECV_ONLY"

    This represents the participant’s current mode.

    pinState: { cam: boolean; share: boolean }

    This represents the current pin state of the participant.

    quality: "low" | "med" | "high"

    This represents the current quality level of the participant’s video stream.

    screenShareAudioOn: boolean

    This indicates whether the participant’s screenshare audio is currently enabled.

    screenShareOn: boolean

    This indicates whether the participant’s screenShare is currently enabled.

    screenShareQuality: "low" | "med" | "high"

    This represents the quality level of the participant’s screen-sharing stream.

    streams: Map<string, Stream>

    This represents all media streams associated with the participant. Streams could be audio , video or share.

    webcamOn: boolean

    This indicates whether the participant’s webcam is currently enabled.

    Methods

      • This method can be used to capture an image from the participant’s current video stream.
      • The captured image is returned as a Base64-encoded string.

      Parameters

      • Optionaloptions: { height?: number; width?: number }
        • Optionalheight?: number

          Desired height of the captured image.

        • Optionalwidth?: number

          Desired width of the captured image.

      Returns Promise<string>

      A Base64-encoded string representing the captured image, or null if the image could not be captured.

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      const participant = Array.from(meeting.participants.values())[0];
      // captureImage returns a Base64 string
      const base64Data = await participant.captureImage();
      console.log("base64", base64Data);
      • This method can be used to disable the remote participant’s microphone.

      Events associated with disableMic():

      • All participants receive a stream-disabled event containing the corresponding stream object.

      Returns void

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      const participant = Array.from(meeting.participants.values())[0];
      participant.disableMic();
      • This method can be used to disable the remote participant’s webcam.

      Events associated with disableWebcam():

      • All participants receive a stream-disabled event containing the corresponding stream object.

      Returns void

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      const participant = Array.from(meeting.participants.values())[0];
      participant.disableWebcam();
      • This method can be used to enable the remote participant’s microphone.

      Events associated with enableMic():

      • The participant first receives a mic-requested event. Once the request is accepted, the microphone is enabled.
      • All participants receive a stream-enabled even containing the corresponding stream object.

      Returns void

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      const participant = Array.from(meeting.participants.values())[0];
      participant.enableMic();
      • This method can be used to enable the remote participant’s webcam.

      Events associated with enableWebcam():

      • The participant first receives a webcam-requested event. Once the request is accepted, the webcam is enabled.

      • All participants receive a stream-enabled event containing the corresponding stream object.

      Returns void

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      const participant = Array.from(meeting.participants.values())[0];
      participant.enableWebcam();
      • This method can be used to get detailed statistics about the participant’s audio stream.
      • These metrics provide insights into stream quality, network conditions, and transmission performance at the time the method is called.

      Returns Promise<
          {
              bitrate: number;
              codec: string;
              jitter: number;
              network: string;
              packetsLost: number;
              rtt: number;
              totalPackets: number;
          }[],
      >

      An array of objects containing the following metrics:

      • jitter – Represents variation in packet arrival time (stream instability).
      • bitrate – The bitrate at which the audio stream is being transmitted.
      • totalPackets – Total number of packets transmitted for the stream.
      • packetsLost – Total number of packets lost during transmission.
      • rtt – Round-trip time (in milliseconds) between the client and server.
      • codec – Codec used for encoding the audio stream.
      • network – Network type used for transmitting the stream.

      Info

      If the rtt value exceeds 300ms, consider switching to a region closer to the user for improved performance. Learn more visit here.

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      const audioStats = await meeting.localParticipant.getAudioStats();
      • This method can be used to get detailed statistics about the participant’s screen share audio stream.
      • These metrics provide insights into stream quality, network conditions, and transmission performance at the time the method is called.

      Returns Promise<
          {
              bitrate: number;
              codec: string;
              jitter: number;
              network: string;
              packetsLost: number;
              rtt: number;
              totalPackets: number;
          }[],
      >

      An array of objects containing the following metrics:

      • jitter – Represents variation in packet arrival time (stream instability).
      • bitrate – The bitrate at which the audio stream is being transmitted.
      • totalPackets – Total number of packets transmitted for the stream.
      • packetsLost – Total number of packets lost during transmission.
      • rtt – Round-trip time (in milliseconds) between the client and server.
      • codec – Codec used for encoding the audio stream.
      • network – Network type used for transmitting the stream.

      Info

      If the rtt value exceeds 300ms, consider switching to a region closer to the user for improved performance. Learn more visit here.

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      const shareAudioStats = await meeting.localParticipant.getShareAudioStats();
      • This method can be used to get detailed statistics about the participant’s screen share video stream.
      • These metrics provide insights into stream quality, network conditions, and transmission performance at the time the method is called.

      Returns Promise<
          {
              bitrate: number;
              codec: string;
              currentSpatialLayer: number;
              currentTemporalLayer: number;
              jitter: number;
              limitation: any;
              network: string;
              packetsLost: number;
              preferredSpatialLayer: number;
              preferredTemporalLayer: number;
              rtt: number;
              size: any;
              totalPackets: number;
          }[],
      >

      An array of objects containing the following metrics:

      • jitter – Represents variation in packet arrival time (stream instability).
      • bitrate – The bitrate at which the video stream is being transmitted.
      • totalPackets – Total number of packets transmitted for the stream.
      • packetsLost – Total number of packets lost during transmission.
      • rtt – Round-trip time (in milliseconds) between the client and server.
      • codec – Codec used for encoding the video stream.
      • network – Network type used for transmitting the stream.
      • limitation – Indicates any limitations affecting stream quality.
      • size – Resolution or size information related to the stream.

      Info

      If the rtt value exceeds 300ms, consider switching to a region closer to the user for improved performance. Learn more visit here.

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      const shareStats = await meeting.localParticipant.getShareStats();
      • This method can be used to get detailed statistics about the participant’s video stream.
      • These metrics provide insights into stream quality, network conditions, and transmission performance at the time the method is called.

      Returns Promise<
          {
              bitrate: number;
              codec: string;
              currentSpatialLayer: number;
              currentTemporalLayer: number;
              jitter: number;
              limitation: any;
              network: string;
              packetsLost: number;
              preferredSpatialLayer: number;
              preferredTemporalLayer: number;
              rtt: number;
              size: any;
              totalPackets: number;
          }[],
      >

      An array of objects containing the following metrics:

      • jitter – Represents variation in packet arrival time (stream instability).
      • bitrate – The bitrate at which the video stream is being transmitted.
      • totalPackets – Total number of packets transmitted for the stream.
      • packetsLost – Total number of packets lost during transmission.
      • rtt – Round-trip time (in milliseconds) between the client and server.
      • codec – Codec used for encoding the video stream.
      • network – Network type used for transmitting the stream.
      • limitation – Indicates any limitations affecting stream quality.
      • size – Resolution or size information related to the stream.

      Info

      If the rtt value exceeds 300ms, consider switching to a region closer to the user for improved performance. Learn more visit here.

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      const videoStats = await meeting.localParticipant.getVideoStats();
    • Removes an event listener that was previously registered.

      Parameters

      • eventType:
            | "stream-enabled"
            | "stream-disabled"
            | "media-status-changed"
            | "video-quality-changed"
            | "stream-paused"
            | "stream-resumed"
            | "e2ee-state-change"

        Event name to which you want to unsubscribe.

      • listener: (data: any) => void

        Callback function which was passed while subscribing to the event.

        To view the complete list of available events and their details, refer to ParticipantEvent.

      Returns void

    • Registers an event listener.

      Parameters

      • eventType:
            | "stream-enabled"
            | "stream-disabled"
            | "media-status-changed"
            | "video-quality-changed"
            | "stream-paused"
            | "stream-resumed"
            | "e2ee-state-change"

        Event name to which you want to subscribe.

      • listener: (data: any) => void

        A callback function that is executed when the specified event is emitted.

        To view the complete list of available events and their details, refer to ParticipantEvent.

      Returns void

      • This method can be used to pin the participant’s camera, screen share, or both.

      • Every participant receives a pin-state-changed event when the pin state is updated.

      Parameters

      • type: "SHARE_AND_CAM" | "CAM" | "SHARE"

        Specifies which stream to pin.

        Allowed values:

        • "SHARE_AND_CAM" – Pins both screen share and camera streams.
        • "CAM" – Pins only the camera stream.
        • "SHARE" – Pins only the screen-share stream.
        SHARE_AND_CAM
        

      Returns void

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      const participant = Array.from(meeting.participants.values())[0];
      participant.pin("CAM");
      • This method can be used to removes the remote participant from the meeting.

      Returns void

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      const participant = Array.from(meeting.participants.values())[0];
      participant.remove();
      • This method creates and returns an HTMLAudioElement that can be used to play incoming audio streams in the DOM.

      Parameters

      • Optionaloptions: { type?: "audio" | "shareAudio" }
        • Optionaltype?: "audio" | "shareAudio"

          Type: "audio" | "shareAudio"

          • "audio" – Renders the participant’s microphone audio stream.
          • "shareAudio" – Renders the audio stream associated with screen sharing.
          "audio"
          

      Returns HTMLAudioElement

      An HTMLAudioElement that plays the requested audio stream.

      const audioElement = participant.renderAudio({
      type: "audio",
      });

      document.body.appendChild(audioElement);
      • This method creates and returns a <div> element that internally manages the rendering of the participant’s video or screen-share stream.
      • It allows you to control the rendered stream type, quality preference and styling of both the video element and its container.

      Parameters

      • Optionaloptions: {
            containerStyle?: Partial<CSSStyleDeclaration>;
            maxQuality?: "low" | "med" | "high" | "auto";
            type?: "video" | "share";
            videostyle?: Partial<CSSStyleDeclaration>;
        }

        Optional configuration for rendering the stream.

        • OptionalcontainerStyle?: Partial<CSSStyleDeclaration>

          CSS styles applied to the outer container <div>.

        • OptionalmaxQuality?: "low" | "med" | "high" | "auto"

          Sets the preferred maximum quality for the rendered stream.

          Allowed value:

          • "auto" – Automatically adapts quality based on network conditions (default)
          • "high" – Highest available quality
          • "med" – Medium quality
          • "low" – Low quality for bandwidth-constrained scenarios
        • Optionaltype?: "video" | "share"

          Specifies which stream to render.

          Allowed value:

          • "video" – Camera video stream (default)
          • "share" – Screen-share video stream
        • Optionalvideostyle?: Partial<CSSStyleDeclaration>

          CSS styles applied directly to the internal <video> element.

      Returns HTMLDivElement

      An HTMLDivElement containing the rendered video or screen-share stream.

      const videoElement = participant.renderVideo({
      type: "video",
      maxQuality: "high",
      videostyle: {
      objectFit: "cover",
      borderRadius: "8px",
      },
      containerStyle: {
      width: "300px",
      height: "200px",
      },
      });

      document.body.appendChild(videoElement);
      • This method can be used to set the incoming video quality of the remote participant.

      Parameters

      • quality: "low" | "med" | "high"

      Returns void

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      const participant = Array.from(meeting.participants.values())[0];
      participant.setQuality("low");
      • This method can be used to set the quality of the incoming screen-share video of the remote participant.

      Parameters

      • quality: "low" | "med" | "high"

      Returns void

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      const participant = Array.from(meeting.participants.values())[0];
      participant.setScreenShareQuality("low");
      • This method can be used to adjust the video quality of the remote participant based on the specified viewport dimensions.

      Parameters

      • width: number

        The width of the viewport used to determine the video quality.

      • height: number

        The height of the viewport used to determine the video quality.

      Returns void

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      const participant = Array.from(meeting.participants.values())[0];
      participant.setViewPort(300,300);
      • This method can be used to unpin the participant’s camera, screen share, or both.

      • Every participant receives a pin-state-changed event when the pin state is updated.

      Parameters

      • type: "SHARE_AND_CAM" | "CAM" | "SHARE"

        Specifies which stream to unpin.

        Allowed values:

        • "SHARE_AND_CAM" – Unpins both screen share and camera streams.
        • "CAM" – Unpins only the camera stream.
        • "SHARE" – Unpins only the screen-share stream.
        "SHARE_AND_CAM"
        

      Returns void

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      const participant = Array.from(meeting.participants.values())[0];
      participant.unpin("CAM");