class AudioPlayer

extends

EventEmitter
export declare class AudioPlayer extends EventEmitter

Used to play audio resources (i.e. tracks, streams) to voice connections.

Constructors

constructor()

Creates a new AudioPlayer.

readonly
playable : VoiceConnection[]

A list of subscribed voice connections that can currently receive audio to play.

The state that the player is in.

checkPlayable() : boolean

Checks whether the underlying resource (if any) is playable (readable)

Returns: true if the resource is playable, otherwise false

pause(
interpolateSilence?: boolean
) : boolean

Pauses playback of the current resource, if any.

Returns: true if the player was successfully paused, otherwise false

play<

Metadata

>(
resource: AudioResource<Metadata>
) : void

Plays a new resource on the player. If the player is already playing a resource, the existing resource is destroyed (it cannot be reused, even in another player) and is replaced with the new resource.

stop(
force?: boolean
) : boolean

Stops playback of the current resource and destroys the resource. The player will either transition to the Idle state, or remain in its current state until the silence padding frames of the resource have been played.

Returns: true if the player will come to a stop, otherwise false

unpause() : boolean

Unpauses playback of the current resource, if any.

Returns: true if the player was successfully unpaused, otherwise false

on(
event: 'error'
listener: (error: AudioPlayerError) => void
) : this

Emitted when there is an error emitted from the audio resource played by the audio player