Class VoiceNextConnection
VoiceNext connection to a voice channel.
Inheritance
Namespace: DSharpPlus.VoiceNext
Assembly: cs.temp.dll.dll
Syntax
public sealed class VoiceNextConnection : IDisposable
Properties
AudioFormat
Gets the audio format used by the Opus encoder.
Declaration
public AudioFormat AudioFormat { get; }
Property Value
Type | Description |
---|---|
AudioFormat |
IsPlaying
Gets whether this connection is still playing audio.
Declaration
public bool IsPlaying { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
TargetChannel
Gets the channel this voice client is connected to.
Declaration
public DiscordChannel TargetChannel { get; }
Property Value
Type | Description |
---|---|
DiscordChannel |
UdpPing
Gets the UDP round-trip time in ms.
Declaration
public int UdpPing { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
WebSocketPing
Gets the websocket round-trip time in ms.
Declaration
public int WebSocketPing { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
Disconnect()
Disconnects and disposes this voice connection.
Declaration
public void Disconnect()
Dispose()
Disconnects and disposes this voice connection.
Declaration
public void Dispose()
Finalize()
Declaration
protected void Finalize()
GetTransmitSink(Int32)
Gets a transmit stream for this connection, optionally specifying a packet size to use with the stream. If a stream is already configured, it will return the existing one.
Declaration
public VoiceTransmitSink GetTransmitSink(int sampleDuration = 20)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | sampleDuration | Duration, in ms, to use for audio packets. |
Returns
Type | Description |
---|---|
VoiceTransmitSink | Transmit stream. |
Pause()
Pauses playback.
Declaration
public void Pause()
ResumeAsync()
Asynchronously resumes playback.
Declaration
public Task ResumeAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
SendSpeakingAsync(Boolean)
Sends a speaking status to the connected voice channel.
Declaration
public Task SendSpeakingAsync(bool speaking = true)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | speaking | Whether the current user is speaking or not. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task representing the sending operation. |
WaitForPlaybackFinishAsync()
Asynchronously waits for playback to be finished. Playback is finished when speaking = false is signalled.
Declaration
public Task WaitForPlaybackFinishAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task representing the waiting operation. |
Events
UserJoined
Triggered whenever a user joins voice in the connected guild.
Declaration
public event AsyncEventHandler<VoiceNextConnection, VoiceUserJoinEventArgs> UserJoined
Event Type
Type | Description |
---|---|
AsyncEventHandler<VoiceNextConnection, VoiceUserJoinEventArgs> |
UserLeft
Triggered whenever a user leaves voice in the connected guild.
Declaration
public event AsyncEventHandler<VoiceNextConnection, VoiceUserLeaveEventArgs> UserLeft
Event Type
Type | Description |
---|---|
AsyncEventHandler<VoiceNextConnection, VoiceUserLeaveEventArgs> |
UserSpeaking
Triggered whenever a user speaks in the connected voice channel.
Declaration
public event AsyncEventHandler<VoiceNextConnection, UserSpeakingEventArgs> UserSpeaking
Event Type
Type | Description |
---|---|
AsyncEventHandler<VoiceNextConnection, UserSpeakingEventArgs> |
VoiceReceived
Triggered whenever voice data is received from the connected voice channel.
Declaration
public event AsyncEventHandler<VoiceNextConnection, VoiceReceiveEventArgs> VoiceReceived
Event Type
Type | Description |
---|---|
AsyncEventHandler<VoiceNextConnection, VoiceReceiveEventArgs> |
VoiceSocketErrored
Triggered whenever voice WebSocket throws an exception.
Declaration
public event AsyncEventHandler<VoiceNextConnection, SocketErrorEventArgs> VoiceSocketErrored
Event Type
Type | Description |
---|---|
AsyncEventHandler<VoiceNextConnection, SocketErrorEventArgs> |