Interface MediaConnection

All Superinterfaces:
AutoCloseable, Closeable
All Known Subinterfaces:
MediaConnectionExperimental
All Known Implementing Classes:
MediaConnectionImpl

public interface MediaConnection extends Closeable
  • 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

      @NotNull KoeClient getClient()
    • getOptions

      @NotNull KoeOptions getOptions()
    • getAudioSender

      @Nullable AudioFrameProvider getAudioSender()
    • getGuildId

      long getGuildId()
    • getGatewayConnection

      @Nullable MediaGatewayConnection getGatewayConnection()
    • getVoiceServerInfo

      @Nullable VoiceServerInfo getVoiceServerInfo()
    • getConnectionHandler

      ConnectionHandler<?> getConnectionHandler()
    • setAudioSender

      void setAudioSender(@Nullable AudioFrameProvider sender)
    • setAudioCodec

      void setAudioCodec(@NotNull CodecInstance audioCodec)
      Sets the audio codec instance for this connection.
      Parameters:
      audioCodec - the codec instance to use
    • setAudioCodec

      default void setAudioCodec(@NotNull CodecInfo info)
      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

      void registerListener(KoeEventListener listener)
    • unregisterListener

      void unregisterListener(KoeEventListener listener)
    • 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:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable