> For the complete documentation index, see [llms.txt](https://ilinked1337.gitbook.io/anarchy/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ilinked1337.gitbook.io/anarchy/documentation/media-sessions/voice-sessions/discordvoicesession.md).

# DiscordVoiceSession

### Inherits from

{% content-ref url="/pages/-MJ8DHAgbUXLYo2Y0pSA" %}
[DiscordMediaSession](/anarchy/documentation/media-sessions/discordmediasession.md)
{% endcontent-ref %}

## Events

| Name               | Description                                                                |
| ------------------ | -------------------------------------------------------------------------- |
| OnConnected        | Fired when the client has connected and authenticated to the server        |
| OnDisconnected     | Fired when the client is forcefully disconnected or Disconnect() is called |
| OnUserConnected    | Fired when a user connects to the voice channel                            |
| OnUserDisconnected | Fired when a user leaves the voice channel                                 |
| OnUserSpeaking     | Fired when a user starts speaking                                          |
| OnChannelChanged   | Triggered whenever the user is moved into another channel                  |

## Properties

| Name       | Description                                        | Type                                 |
| ---------- | -------------------------------------------------- | ------------------------------------ |
| Speaking   | True if the client is sending voice data           | bool                                 |
| Livestream | A reference to the Go Live created by the client   | DiscordGoLiveSession?                |
| Watching   | A reference to the Go Lives the client is watching | IReadOnlyList\<DiscordGoLiveSession> |

## Methods

### SetSpeakingState

Sets the client's speaking flags.

#### Parameters

| Name  | Description        | Type                 |
| ----- | ------------------ | -------------------- |
| flags | The speaking flags | DiscordSpeakingFlags |

### GoLive

Starts a Go Live session. This will set Livestream.

#### Returns

{% content-ref url="/pages/-MJ8HM\_8cZ0b5ZQEzWb4" %}
[DiscordGoLiveSession](/anarchy/documentation/media-sessions/go-live-sessions/discordgolivesession.md)
{% endcontent-ref %}

### WatchGoLive

Connects to another user's Go Live. This will add a stream to Watching.

#### Parameters

| Name   | Description                                  | Type  |
| ------ | -------------------------------------------- | ----- |
| userId | The ID of the user who's livestream to watch | ulong |

#### Returns

{% content-ref url="/pages/-MJ8HM\_8cZ0b5ZQEzWb4" %}
[DiscordGoLiveSession](/anarchy/documentation/media-sessions/go-live-sessions/discordgolivesession.md)
{% endcontent-ref %}

### CreateStream

Creates a voice stream which you can send data through to speak.

#### Parameters

| Name        | Description                                                                         | Type              |
| ----------- | ----------------------------------------------------------------------------------- | ----------------- |
| bitrate     | The bitrate at which to send data through. Values between 5000 and 384000 are valid | int               |
| application | Lets you optimize the encoder for a specific type of audio                          | AudioApplication? |

#### Returns

{% content-ref url="/pages/-MJCPzv-LlAxMcf1E0pN" %}
[DiscordVoiceStream](/anarchy/documentation/media-sessions/voice-sessions/discordvoicestream.md)
{% endcontent-ref %}
