-
Notifications
You must be signed in to change notification settings - Fork 144
VoiceConnection
Represents a connection to a Discord voice server.
Instances of this class should not be constructed by users.
Name | Type | Description |
---|---|---|
channel | GuildVoiceChannel/nil | The corresponding GuildVoiceChannel for this connection, if one exists. |
Stops the audio stream for this connection, if one is active, disconnects from the voice server, and leaves the corresponding voice channel. Like most Discordia methods, this must be called inside of a coroutine.
Returns: boolean
Returns the bitrate of the interal Opus encoder in bits per second (bps).
Returns: nil
Returns the complexity of the interal Opus encoder.
Returns: number
Temporarily pauses the audio stream for this connection, if one is active. Like most Discordia methods, this must be called inside of a coroutine, as it will yield until the stream is actually paused, usually on the next tick.
Returns: nil
Parameter Type Optional path string duration number ✔ Plays audio over the established connection using an FFmpeg process, assuming FFmpeg is properly configured. If a duration (in milliseconds) is provided, the audio stream will automatically stop after that time has elapsed; otherwise, it will play until the source is exhausted. The returned number is the time elapsed while streaming and the returned string is a message detailing the reason why the stream stopped. For more information about using FFmpeg, see the voice page.
Returns: number,
Parameter Type Optional source string/function/table/userdata duration number ✔ Plays PCM data over the established connection. If a duration (in milliseconds) is provided, the audio stream will automatically stop after that time has elapsed; otherwise, it will play until the source is exhausted. The returned number is the time elapsed while streaming and the returned string is a message detailing the reason why the stream stopped. For more information about acceptable sources, see the voice page.
Returns: number,
Resumes the audio stream for this connection, if one is active and paused. Like most Discordia methods, this must be called inside of a coroutine, as it will yield until the stream is actually resumed, usually on the next tick.
Returns: nil
Parameter Type bitrate number Sets the bitrate of the interal Opus encoder in bits per second (bps). This should be between 8000 and 128000, inclusive.
Returns: nil
Parameter Type complexity number Sets the complexity of the interal Opus encoder. This should be between 0 and 10, inclusive.
Returns: nil
Irreversibly stops the audio stream for this connection, if one is active. Like most Discordia methods, this must be called inside of a coroutine, as it will yield until the stream is actually stopped, usually on the next tick.
Returns: nil