Javascript API Reference
    Preparing search index...

    Type Alias AgentParticipantEvent

    type AgentParticipantEvent = {
        "agent-state-changed": (data: { state: string }) => void;
        "agent-transcription-received": (
            data: {
                participant: Participant | AgentParticipant;
                segment: { text: string; timestamp: number };
            },
        ) => void;
        "media-status-changed": (data: { kind: string; newStatus: string }) => void;
        "stream-disabled": (stream: Stream) => void;
        "stream-enabled": (stream: Stream) => void;
    }
    Index

    Events

    "agent-state-changed": (data: { state: string }) => void

    Triggered when the state of the agentParticipant changes.

    Type Declaration

      • (data: { state: string }): void
      • Parameters

        • data: { state: string }
          • state: string

            This represents the current state of the agentParticipant.

            Possible values: AgentState

        Returns void

    agentParticipant?.on("agent-state-changed", (data) => {
    const { state } = data;

    if (state === VideoSDK.Constants.AgentState.SPEAKING) {
    console.log("Agent is speaking...");
    }

    });
    "agent-transcription-received": (
        data: {
            participant: Participant | AgentParticipant;
            segment: { text: string; timestamp: number };
        },
    ) => void

    Triggered when a transcription is received from a participant or agent.

    Type Declaration

      • (
            data: {
                participant: Participant | AgentParticipant;
                segment: { text: string; timestamp: number };
            },
        ): void
      • Parameters

        • data: {
              participant: Participant | AgentParticipant;
              segment: { text: string; timestamp: number };
          }
          • participant: Participant | AgentParticipant

            This represents the participant whose speech is transcribed. It can be either an AgentParticipant or a regular Participant, depending on who is speaking.

          • segment: { text: string; timestamp: number }

            This represents the transcription segment.

            • text: string

              This represents the transcribed text.

            • timestamp: number

              This represents the timestamp of the transcription.

        Returns void

    agentParticipant?.on("agent-transcription-received", (data) => {
    const { segment, participant } = data;
    const { text, timestamp } = segment;

    console.log(`${participant.displayName} said "${text}" at ${timestamp}`);
    });
    "media-status-changed": (data: { kind: string; newStatus: string }) => void

    Triggered when the media status of a participant changes (for example, when audio or video is enabled or disabled).

    Type Declaration

      • (data: { kind: string; newStatus: string }): void
      • Parameters

        • data: { kind: string; newStatus: string }
          • kind: string

            Type of stream whose status changed.

          • newStatus: string

            The updated status of the stream.

        Returns void

    agentParticipant.on("media-status-changed", (data) => {
    const { kind, newStatus } = data;
    });
    "stream-disabled": (stream: Stream) => void

    Triggered when a participant’s audio, video, or screen-share Stream is disabled.

    Type Declaration

      • (stream: Stream): void
      • Parameters

        • stream: Stream

          The stream that was disabled.

        Returns void

    agentParticipant.on("stream-disabled", (stream) => {
    //
    });
    "stream-enabled": (stream: Stream) => void

    Triggered when a participant’s audio, video, or screen-share Stream is enabled.

    Type Declaration

      • (stream: Stream): void
      • Parameters

        • stream: Stream

          The stream that was enabled.

        Returns void

    agentParticipant.on("stream-enabled", (stream) => {
    //
    });