> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vmonster.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Events

In the `VmonsterRoom`, several events of type `Event` may occur, which are essential for handling interactions and monitoring the state of the session.

The following are the key events:

***

<ParamField path="joining">
  Triggering when an attempt is made to connect the AI Avatar Stream. It occurs immediately upon calling the `join()` function.
</ParamField>

<ParamField path="joined">
  Occuring when the AI Avatar Stream connection is successfully completed.
</ParamField>

<ParamField path="left">
  Triggering when the AI Avatar Stream connection is terminated.
</ParamField>

<ParamField path="aiavatar-start-speaking">
  Triggering when the AI Avatar begins speaking. It allows you to determine whether the AI Avatar is currently speaking.
</ParamField>

<ParamField path="aiavatar-message">
  Occuring when the AI Avatar sends a message. It enables you to review messages sent by the AI Avatar.
</ParamField>

<ParamField path="aiavatar-stop-speaking">
  Triggering when the AI Avatar stops speaking. It allows you to determine whether the AI Avatar is currently speaking.
</ParamField>

<ParamField path="aiavatar-video-track">
  Triggering when the AI Avatar video track connected. Video MediaStream is passed to the callback.
</ParamField>

<ParamField path="aiavatar-audio-track">
  Triggering when the AI Avatar audio track connected. Audio MediaStream is passed to the callback.
</ParamField>

<ParamField path="stt-data" body="aa">
  Triggered repeatedly while the user’s audio is unmuted and they are speaking. It sends speech-to-text (STT) results one by one to the callback as STTData.

  ```typescript theme={null}
  type STTDataEventType = "transcript" | "start_of_speech" | "end_of_speech";
  type STTData = {
    text: string; // contains transcription text.
    eventType: STTDataEventType;
    type: "stt-data";
  };
  ```

  `STTDataEventType`

  * `“transcript”` – The finalized transcription of the user’s speech audio.
  * `“start_of_speech”` – Indicates the start of the user speaking. This means the Voice Activity Detection (VAD) system has detected the beginning of human speech.
  * `“end_of_speech”` - Indicates the end of the user speaking. This means the Voice Activity Detection (VAD) system has detected the cessation of human speech.
</ParamField>

<ParamField path="stt-error">
  Occurs when real-time STT cannot be performed successfully.
</ParamField>

## Handling Events

To attach callbacks to these events, use `on()` method.

<Card title="Callback Functions" icon="share-from-square" href="/callback_Functions">
  Learn about how to add callback function to Events
</Card>
