Javascript API Reference
    Preparing search index...

    Class AgentParticipant

    Index

    Constructors

    Properties

    agentId: string

    This represents the agent ID of the agentParticipant.

    displayName: string

    This represents display name of the agentParticipant.

    id: string

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

    isAgent: boolean

    This represents whether the participant is an agent.

    metaData: object

    This represents agentParticipant’s metadata provided while initializing the meeting

    micOn: boolean

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

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

    This represents the agentParticipant’s current mode.

    pinState: { cam: boolean; share: boolean }

    This represents the current pin state of the agentParticipant.

    streams: Map<string, Stream>

    This represents all media streams associated with the agentParticipant. Streams could be audio or video.

    webcamOn: boolean

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

    Methods

      • This method can be used to get detailed statistics about the agentParticipant'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 agentParticipant = Array.from(meeting.participants.values()).find(
      (p) => p.isAgent
      );

      const audioStats = await agentParticipant.getAudioStats();
      • This method can be used to get detailed statistics about the agentParticipant'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 agentParticipant = Array.from(meeting.participants.values()).find(
      (p) => p.isAgent
      );

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

      Parameters

      • eventType:
            | "stream-enabled"
            | "stream-disabled"
            | "media-status-changed"
            | "agent-state-changed"
            | "agent-transcription-received"

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

      Returns void

    • Registers an event listener.

      Parameters

      • eventType:
            | "stream-enabled"
            | "stream-disabled"
            | "media-status-changed"
            | "agent-state-changed"
            | "agent-transcription-received"

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

      Returns void

      • This method can be used to pin the agentParticipant’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 agentParticipant = Array.from(meeting.participants.values()).find(
      (p) => p.isAgent
      );

      agentParticipant.pin("CAM");
      • This method can be used to removes the remote agentParticipant from the meeting.

      Returns void

      let meeting;

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

      const agentParticipant = Array.from(meeting.participants.values()).find(
      (p) => p.isAgent
      );

      agentParticipant.remove();
      • This method creates and returns an HTMLAudioElement that can be used to play incoming audio streams in the DOM.

      Parameters

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

          Type: `"audio"

          • "audio" – Renders the agentParticipant's microphone audio stream.

      Returns HTMLAudioElement

      An HTMLAudioElement that plays the requested audio stream.

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

      document.body.appendChild(audioElement);
      • This method creates and returns a <div> element that internally manages the rendering of the agentParticipant’s video 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";
            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"

          Specifies which stream to render.

          Allowed value:

          • "video" – Camera 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 = agentParticipant.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 unpin the agentParticipant’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 agentParticipant = Array.from(meeting.participants.values()).find(
      (p) => p.isAgent
      );

      agentParticipant.unpin("CAM");