Class: AudioPlayer

AudioPlayer(guild)

Handles audio playback on guilds. An instance is automatically created for each guild by the GuildManager To access it from a command callback, use the data.audioPlayerObject.

Constructor

new AudioPlayer(guild)

Instantiates a new audio player.
Parameters:
Name Type Description
guild Discord.Guild Discord guild object.
Source:

Members

currentStream

Current stream object
Source:

ffmpegProcess

FFMPEG process
Source:

guild

Associated guild
Source:

timestamp :number

Current playback timestamp.
Type:
  • number
Source:

voiceConnection

Current voice connection
Source:

Methods

clean(disconnect)

Cleans resources and (optionally) disconnects from the voice channel.
Parameters:
Name Type Description
disconnect boolean Set to true to disconnect
Source:

(async) join(voiceChannel) → {Promise.<Object>}

Joins a voice channel.
Parameters:
Name Type Description
voiceChannel object Discord voice channel object
Source:
Returns:
Discord voice connection object
Type
Promise.<Object>

(async) play(voiceChannel, path, flags) → {Promise.<Object>}

Plays an audio stream.
Parameters:
Name Type Description
voiceChannel Discord.VoiceChannel Discordie VoiceChannel object
path String Stream path or URL
flags object Flags to append to the FFMpeg command
Properties
Name Type Description
input Array.<string> Input flags
output Array.<string> Output flags
Source:
Returns:
Discord encoder object
Type
Promise.<Object>

stop(disconnect, removeEvents)

Attempts to stop playback.
Parameters:
Name Type Description
disconnect boolean Set to true to also disconnect from the voice channel
removeEvents boolean Remove event listeners before sending the stream.
Source: