LavalinkPlayer

class LavalinkPlayer(node: LavalinkNode, protocolPlayer: Player) : IUpdatablePlayer

Represents a player that is tied to a guild.

Constructors

Link copied to clipboard
constructor(node: LavalinkNode, protocolPlayer: Player)

Properties

Link copied to clipboard
val filters: Filters
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var state: PlayerState

Gets the current state of the player. See PlayerState for more info.

Link copied to clipboard
var track: Track?

Gets the current track that is playing on the player.

Link copied to clipboard
val voiceState: VoiceState
Link copied to clipboard
val volume: Int

Number between 0 and 1000, where 100 is 100% volume.

Functions

Link copied to clipboard
Link copied to clipboard

Omits the encoded track field from being sent to the node during updates.

Link copied to clipboard
open override fun omitEndTime(): PlayerUpdateBuilder

Omits the end time from being sent to the node during updates.

Link copied to clipboard
open override fun setEncodedTrack(encodedTrack: String?): PlayerUpdateBuilder

Sets the encoded track to be played. This will override the identifier and track user data if they were previously set.

Link copied to clipboard
open override fun setEndTime(endTime: Long?): PlayerUpdateBuilder

Update the end time of the track.

Link copied to clipboard
open override fun setFilters(filters: Filters): PlayerUpdateBuilder

Update the filters for the player. Please use setVolume to update the player's volume instead. Setting the volume via filters is float based (1.0f is 100% volume) and takes the time of your buffer size to apply.

Link copied to clipboard
open override fun setIdentifier(identifier: String?): PlayerUpdateBuilder

Set the identifier on the player. This will override the encoded track and user data if they were previously set.

Link copied to clipboard
open override fun setPaused(paused: Boolean): PlayerUpdateBuilder

Update the paused state of the player.

Link copied to clipboard
open override fun setPosition(position: Long?): PlayerUpdateBuilder

Update the position of the player.

Link copied to clipboard
open override fun setTrack(track: Track?): PlayerUpdateBuilder

Shortcut for setting the encoded track. This will also send any user-data supplied.

Link copied to clipboard
open override fun setVoiceState(state: VoiceState): PlayerUpdateBuilder

Update the voice state for the player.
IMPORTANT: Only ever use Link.onVoiceServerUpdate to update the voice server as this sets the state of the link to LinkState.CONNECTING

Link copied to clipboard
open override fun setVolume(volume: Int): PlayerUpdateBuilder

Update the volume of the player. While you could use the filters to set volume as well, do note that that is float based (1.0f is 100% volume) and takes the time of your buffer size to apply. This method updates the volume instantly after the update is sent out.

Link copied to clipboard
open override fun stopTrack(): PlayerUpdateBuilder

Shortcut for setting the encoded track to {@code null}. This will also clear the user data.

Link copied to clipboard

Allows you to set the track via the TrackUpdateBuilder. To stop the player, you can use stopTrack or setTrack with a null track.

open override fun updateTrack(update: PlayerUpdateTrack): PlayerUpdateBuilder

Allows you to set the track via the TrackUpdateBuilder. To stop the player, you can use stopTrack or setTrack with a null track.