Package moe.kyokobot.koe
Interface MediaConnection
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Subinterfaces:
MediaConnectionExperimental
- All Known Implementing Classes:
MediaConnectionImpl
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes and disposes this connection, cannot be used after this method is called.connect(VoiceServerInfo info) Connects to Discord voice server using specified info.voidStops polling media frames, disconnects from the gateway and cleans everything up.longvoidvoidregisterListener(KoeEventListener listener) default voidsetAudioCodec(CodecInfo info) Sets the audio codec using a codec info (convenience method).voidsetAudioCodec(CodecInstance audioCodec) Sets the audio codec instance for this connection.voidsetAudioSender(AudioFrameProvider sender) voidStarts polling audio frames.voidStops polling audio frames.voidunregisterListener(KoeEventListener listener) voidupdateSpeakingState(int mask) Sends speaking state notification to the gateway.
-
Method Details
-
connect
Connects to Discord voice server using specified info.- Parameters:
info- Discord voice server connection information- Returns:
- future which completes once Koe is connected to both voice gateway and can successfully send UDP packets, so you can send audio data.
-
disconnect
void disconnect()Stops polling media frames, disconnects from the gateway and cleans everything up.- See Also:
-
reconnect
void reconnect() -
getClient
-
getOptions
-
getAudioSender
-
getGuildId
long getGuildId() -
getGatewayConnection
-
getVoiceServerInfo
-
getConnectionHandler
ConnectionHandler<?> getConnectionHandler() -
setAudioSender
-
setAudioCodec
Sets the audio codec instance for this connection.- Parameters:
audioCodec- the codec instance to use
-
setAudioCodec
Sets the audio codec using a codec info (convenience method). Creates a codec instance with default payload types.- Parameters:
info- the codec info to use
-
startAudioFramePolling
void startAudioFramePolling()Starts polling audio frames. Called automatically after connecting, you don't have to. -
stopAudioFramePolling
void stopAudioFramePolling()Stops polling audio frames.- See Also:
-
registerListener
-
unregisterListener
-
updateSpeakingState
void updateSpeakingState(int mask) Sends speaking state notification to the gateway.- Parameters:
mask- new speaking state
-
close
void close()Closes and disposes this connection, cannot be used after this method is called.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-