AudioManager interface manages audio connections to voice channels and controls audio handlers for sending and receiving audio in a Guild.
Audio receiving requires the DAVE (Discord Audio Video Encryption) protocol. See the Discord documentation for more information.
Getting an AudioManager
Retrieve the AudioManager from a Guild:Connection Methods
openAudioConnection
Opens an audio connection to a voice channel, or moves an existing connection.The voice or stage channel to connect to
closeAudioConnection
Closes the current audio connection.isConnected
Checks if there is an active audio connection.true if an active audio connection existsgetConnectedChannel
Gets the currently connected audio channel.The connected channel, or
null if not connectedAudio Handler Methods
setSendingHandler
Sets the handler that provides audio data to send.The audio send handler, or
null to removeJDA recommends LavaPlayer as an AudioSendHandler implementation.
getSendingHandler
Gets the current audio send handler.The current send handler, or
null if none is setsetReceivingHandler
Sets the handler that processes received audio data.The audio receive handler, or
null to removegetReceivingHandler
Gets the current audio receive handler.The current receive handler, or
null if none is setSpeaking Mode
setSpeakingMode
Sets the speaking mode for the audio connection.The speaking modes to use (default:
VOICE)getSpeakingMode
Gets the current speaking mode.The current speaking modes
Connection Configuration
setConnectTimeout
Sets the connection timeout in milliseconds.Timeout in milliseconds (default: 10000). Set to 0 to wait indefinitely.
getConnectTimeout
Gets the current connection timeout.The connection timeout in milliseconds
setAutoReconnect
Sets whether to automatically reconnect on connection loss.true to enable auto-reconnect (default)isAutoReconnect
Checks if auto-reconnect is enabled.true if auto-reconnect is enabledSelf State Methods
setSelfMuted
Sets whether the bot should be muted.true to mute the botWhen muted, audio packets from the AudioSendHandler will be ignored by Discord.
isSelfMuted
Checks if the bot is muted.true if the bot is mutedsetSelfDeafened
Sets whether the bot should be deafened.true to deafen the botisSelfDeafened
Checks if the bot is deafened.true if the bot is deafenedConnection Status
getConnectionStatus
Gets the current connection status.The current connection status
setConnectionListener
Sets a listener for connection status updates.The connection listener, or
null to removegetConnectionListener
Gets the current connection listener.The current connection listener, or
null if none is setOther Methods
getJDA
Gets the JDA instance this AudioManager belongs to.The JDA instance
getGuild
Gets the Guild this AudioManager manages.The Guild instance