Package org.javacord.api.audio
Interface AudioConnection
-
- All Superinterfaces:
AudioConnectionAttachableListenerManager
public interface AudioConnection extends AudioConnectionAttachableListenerManager
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<java.lang.Void>close()Disconnects from the voice channel.java.util.Optional<AudioSource>getAudioSource()Gets the audio source.ServerVoiceChannelgetChannel()Gets the voice channel of the audio connection.default ServergetServer()Gets the server of the audio connection.java.util.Set<SpeakingFlag>getSpeakingFlags()Gets the speaking flags of this connection.booleanisPrioritySpeaking()Gets the priority speaker status of this connection.booleanisSelfDeafened()Gets the self-deafened status of this connection.booleanisSelfMuted()Gets the self-muted status of this connection.java.util.concurrent.CompletableFuture<java.lang.Void>moveTo(ServerVoiceChannel destChannel)Moves the connection to a different channel.java.util.concurrent.CompletableFuture<java.lang.Void>moveTo(ServerVoiceChannel destChannel, boolean selfMute, boolean selfDeafen)Moves the connection to a different channel.voidremoveAudioSource()Removes the audio source.voidsetAudioSource(AudioSource source)Sets the audio source, replacing any currently playing source.voidsetPrioritySpeaking(boolean prioritySpeaking)Sets the priority speaker status of this connection.voidsetSelfDeafened(boolean deafened)Sets the self-deafened status of this connection.voidsetSelfMuted(boolean muted)Sets the self-muted status of this connection.-
Methods inherited from interface org.javacord.api.listener.audio.AudioConnectionAttachableListenerManager
addAudioConnectionAttachableListener, addAudioSourceFinishedListener, getAudioConnectionAttachableListeners, getAudioSourceFinishedListeners, removeAudioConnectionAttachableListener, removeListener
-
-
-
-
Method Detail
-
moveTo
java.util.concurrent.CompletableFuture<java.lang.Void> moveTo(ServerVoiceChannel destChannel)
Moves the connection to a different channel. The channel must be in the same server as the current connection.- Parameters:
destChannel- The channel to move to.- Returns:
- A CompletableFuture indicating whether the move was successful.
-
moveTo
java.util.concurrent.CompletableFuture<java.lang.Void> moveTo(ServerVoiceChannel destChannel, boolean selfMute, boolean selfDeafen)
Moves the connection to a different channel. The channel must be in the same server as the current connection.- Parameters:
destChannel- The channel to move to.selfMute- Whether to be self-muted on join.selfDeafen- Whether to be self-deafened on join.- Returns:
- A CompletableFuture indicating whether the move was successful.
-
close
java.util.concurrent.CompletableFuture<java.lang.Void> close()
Disconnects from the voice channel.A disconnected audio connection cannot be reused!
- Returns:
- A CompletableFuture which completes when the connection has been disconnected.
-
getAudioSource
java.util.Optional<AudioSource> getAudioSource()
Gets the audio source.- Returns:
- The audio source.
-
setAudioSource
void setAudioSource(AudioSource source)
Sets the audio source, replacing any currently playing source.- Parameters:
source- The audio source which will become the source.
-
removeAudioSource
void removeAudioSource()
Removes the audio source.
-
getChannel
ServerVoiceChannel getChannel()
Gets the voice channel of the audio connection.- Returns:
- The voice channel of the audio connection.
-
isSelfMuted
boolean isSelfMuted()
Gets the self-muted status of this connection.This is solely visual. A muted bot can still play audio.
- Returns:
- Whether the connection is self-muted.
-
setSelfMuted
void setSelfMuted(boolean muted)
Sets the self-muted status of this connection.This is solely visual. A muted bot can still play audio.
- Parameters:
muted- Whether to self-mute this connection.
-
isSelfDeafened
boolean isSelfDeafened()
Gets the self-deafened status of this connection.This is solely visual. A deafened bot can still receive audio.
- Returns:
- Whether the connection is self-deafened.
-
setSelfDeafened
void setSelfDeafened(boolean deafened)
Sets the self-deafened status of this connection.This is solely visual. A deafened bot can still receive audio.
- Parameters:
deafened- Whether to self-deafen this connection.
-
isPrioritySpeaking
boolean isPrioritySpeaking()
Gets the priority speaker status of this connection.- Returns:
- Whether the connection is priority speaking.
-
setPrioritySpeaking
void setPrioritySpeaking(boolean prioritySpeaking)
Sets the priority speaker status of this connection.- Parameters:
prioritySpeaking- Whether to become a priority speaker.
-
getSpeakingFlags
java.util.Set<SpeakingFlag> getSpeakingFlags()
Gets the speaking flags of this connection.- Returns:
- The current speaking flags of this connection.
-
getServer
default Server getServer()
Gets the server of the audio connection.- Returns:
- The server of the audio connection.
-
-