Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Conversation

Hierarchy

  • Conversation

Index

Properties

Static Readonly defaultCountry

defaultCountry: "us" = "us"

Static Readonly defaultModel

defaultModel: "en" = "en"

Static Readonly validCountries

validCountries: Set<string> = new Set(["fr", "us"])

Static Readonly validModels

validModels: Set<string> = new Set(["es", "fr", "en"])

Events Methods

onClose

  • Subscribe to Conversation onClose event.

    example
    const uhlive = new Uhlive("my-token");
    const conversation = uhlive.join("test");
    conversation.onClose(() => {
      // Choose what to do when the conversation is closed.
    })

    Parameters

    • callback: () => void
        • (): void
        • Returns void

    Returns Conversation

onEntityFound

  • This event is triggered when the specified entity has been found or the wildcard is used and any entity is found.

    example
    const uhlive = new Uhlive("my-token");
    const myConversation = uhlive.join("my-conversation");
    myConversation.onEntityFound("LocationCity", (entity) => {
        // Do something with `entity`...
    });

    Parameters

    Returns Conversation

onError

  • Subscribe to Conversation onError event.

    example
    const uhlive = new Uhlive("my-token");
    const conversation = uhlive.join("test");
    conversation.onError((msg) => console.log(msg))

    Parameters

    • callback: (payload: any) => void
        • (payload: any): void
        • Parameters

          • payload: any

          Returns void

    Returns Conversation

onSegmentDecoded

  • The onSegmentDecoded event is triggered when a final transcript is received.

    example
    const uhlive = new Uhlive("my-token");
    const myConversation = uhlive.join("my-conversation");
    myConversation.onSegmentDecoded((transcript) => {
        // Do something with `transcript`...
    });

    Parameters

    Returns Conversation

onSpeakerJoined

  • The speaker_joined event is triggered when a speaker join the conversation. It is sent to everyone except the speaker itself. Note that users connected in read-only mode (observers) don't emit this event.

    example
    const uhlive = new Uhlive("my-token");
    const myConversation = uhlive.join("my-conversation");
    myConversation.onSpeakerJoined((payload) => {
        // Do something with `payload`...
    });

    Parameters

    Returns Conversation

onSpeakerLeft

  • The speaker_left event is triggered when a speaker leaves, or more abruptly, closes its connection. This event is published after all remaining transcript events of this speaker have been published. Note that users connected in read-only mode (observers) don't emit this event.

    example
    const uhlive = new Uhlive("my-token");
    const myConversation = uhlive.join("my-conversation");
    myConversation.onSpeakerLeft((speaker) => {
        // Do something with `speaker`...
    });

    Parameters

    Returns Conversation

onWordsDecoded

  • The words_decoded event is triggered when an interim transcript is received. Following words_decoded events for the same audio are susceptible to be different, until a final transcript is sent with the segment_decoded event.

    example
    const uhlive = new Uhlive("my-token");
    const myConversation = uhlive.join("my-conversation");
    myConversation.onWordsDecoded((transcript) => {
        // Do something with `transcript`...
    });

    Parameters

    Returns Conversation

Recording Methods

isRecording

  • isRecording(): boolean
  • Get the recording status of the conversation.

    example
    const uhlive = new Uhlive("my-token");
    uhlive
        .join("my-conversation")
        .isRecording(); // true
    example
    const uhlive = new Uhlive("my-token");
    uhlive
        .join("my-conversation", {readonly: true})
        .isRecording(); // false

    Returns boolean