Use RealtimeTranscriber instead

Hierarchy (view full)

Constructors

Methods

  • Close the connection to the server.

    Parameters

    • waitForSessionTermination: boolean = true

      If true, the method will wait for the session to be terminated before closing the connection. While waiting for the session to be terminated, you will receive the final transcript and session information.

    Returns Promise<void>

  • Listen for the open event which is emitted when the connection is established and the session begins.

    Parameters

    Returns void

  • Listen for the transcript event which is emitted when a partian or final transcript is received.

    Parameters

    • event: "transcript"

      The transcript event.

    • listener: ((transcript: RealtimeTranscript) => void)

      The function to call when the event is emitted.

    Returns void

  • Listen for the partial transcript event which is emitted when a partial transcript is received.

    Parameters

    • event: "transcript.partial"

      The partial transcript event.

    • listener: ((transcript: PartialTranscript) => void)

      The function to call when the event is emitted.

    Returns void

  • Listen for the final transcript event which is emitted when a final transcript is received.

    Parameters

    • event: "transcript.final"

      The final transcript event.

    • listener: ((transcript: FinalTranscript) => void)

      The function to call when the event is emitted.

    Returns void

  • Listen for the session information event which is emitted when session information is received. The session information is sent right before the session is terminated.

    Parameters

    • event: "session_information"

      The session information event.

    • listener: ((info: SessionInformation) => void)

      The function to call when the event is emitted.

    Returns void

  • Listen for the error event which is emitted when an error occurs.

    Parameters

    • event: "error"

      The error event.

    • listener: ((error: Error) => void)

      The function to call when the event is emitted.

        • (error): void
        • Parameters

          • error: Error

          Returns void

    Returns void

  • Listen for the close event which is emitted when the connection is closed.

    Parameters

    • event: "close"

      The close event.

    • listener: ((code: number, reason: string) => void)

      The function to call when the event is emitted.

        • (code, reason): void
        • Parameters

          • code: number
          • reason: string

          Returns void

    Returns void

  • Create a writable stream that can be used to send audio data to the server.

    Returns WritableStream<ArrayBufferLike>

    A writable stream that can be used to send audio data to the server.