Package moe.kyokobot.koe.internal
Class MediaConnectionImpl
java.lang.Object
moe.kyokobot.koe.internal.MediaConnectionImpl
- All Implemented Interfaces:
Closeable,AutoCloseable,MediaConnectionExperimental,MediaConnection
public class MediaConnectionImpl
extends Object
implements MediaConnection, MediaConnectionExperimental
-
Constructor Summary
Constructors -
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.voidvoidStops polling media frames, disconnects from the gateway and cleans everything up.@Nullable AudioFrameProvider@NotNull KoeClient@Nullable MediaGatewayConnectionlong@NotNull KoeOptionsint@Nullable VideoFrameProvider@Nullable VoiceServerInfovoidvoidregisterListener(KoeEventListener listener) voidsetAudioCodec(@NotNull CodecInstance audioCodec) Sets the audio codec instance for this connection.voidsetAudioSender(@Nullable AudioFrameProvider sender) voidsetConnectionHandler(ConnectionHandler<?> connectionHandler) voidsetSpeakingMask(int mask) Sets speaking flags announced to the gateway when audio playback starts, seeSpeakingFlags.voidsetVideoCodec(@Nullable CodecInstance videoCodec) Sets the video codec instance for this connection.voidsetVideoSender(@Nullable VideoFrameProvider sender) voidStarts polling audio frames.voidStarts polling video frames.voidStops polling audio frames.voidStops polling video frames.voidunregisterListener(KoeEventListener listener) voidupdateSpeakingState(int mask) Sends speaking state notification to the gateway.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface moe.kyokobot.koe.MediaConnection
setAudioCodecMethods inherited from interface moe.kyokobot.koe.experimental.MediaConnectionExperimental
setVideoCodec
-
Constructor Details
-
MediaConnectionImpl
-
-
Method Details
-
connect
Description copied from interface:MediaConnectionConnects to Discord voice server using specified info.- Specified by:
connectin interfaceMediaConnection- 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
public void disconnect()Description copied from interface:MediaConnectionStops polling media frames, disconnects from the gateway and cleans everything up.- Specified by:
disconnectin interfaceMediaConnection- See Also:
-
reconnect
public void reconnect()- Specified by:
reconnectin interfaceMediaConnection
-
getClient
- Specified by:
getClientin interfaceMediaConnection
-
getOptions
- Specified by:
getOptionsin interfaceMediaConnection
-
getAudioSender
- Specified by:
getAudioSenderin interfaceMediaConnection
-
getVideoSender
- Specified by:
getVideoSenderin interfaceMediaConnectionExperimental
-
getGuildId
public long getGuildId()- Specified by:
getGuildIdin interfaceMediaConnection
-
getGatewayConnection
- Specified by:
getGatewayConnectionin interfaceMediaConnection
-
getVoiceServerInfo
- Specified by:
getVoiceServerInfoin interfaceMediaConnection
-
getConnectionHandler
- Specified by:
getConnectionHandlerin interfaceMediaConnection
-
setAudioSender
- Specified by:
setAudioSenderin interfaceMediaConnection
-
setAudioCodec
Description copied from interface:MediaConnectionSets the audio codec instance for this connection.- Specified by:
setAudioCodecin interfaceMediaConnection- Parameters:
audioCodec- the codec instance to use
-
startAudioFramePolling
public void startAudioFramePolling()Description copied from interface:MediaConnectionStarts polling audio frames. Called automatically after connecting, you don't have to.- Specified by:
startAudioFramePollingin interfaceMediaConnection
-
stopAudioFramePolling
public void stopAudioFramePolling()Description copied from interface:MediaConnectionStops polling audio frames.- Specified by:
stopAudioFramePollingin interfaceMediaConnection- See Also:
-
setVideoSender
- Specified by:
setVideoSenderin interfaceMediaConnectionExperimental
-
setVideoCodec
Description copied from interface:MediaConnectionExperimentalSets the video codec instance for this connection.- Specified by:
setVideoCodecin interfaceMediaConnectionExperimental- Parameters:
videoCodec- the codec instance to use, or null to disable video
-
startVideoFramePolling
public void startVideoFramePolling()Description copied from interface:MediaConnectionExperimentalStarts polling video frames. Called automatically after connecting if codec has been set.- Specified by:
startVideoFramePollingin interfaceMediaConnectionExperimental
-
stopVideoFramePolling
public void stopVideoFramePolling()Description copied from interface:MediaConnectionExperimentalStops polling video frames.- Specified by:
stopVideoFramePollingin interfaceMediaConnectionExperimental- See Also:
-
registerListener
- Specified by:
registerListenerin interfaceMediaConnection
-
unregisterListener
- Specified by:
unregisterListenerin interfaceMediaConnection
-
close
public void close()Description copied from interface:MediaConnectionCloses and disposes this connection, cannot be used after this method is called.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceMediaConnection
-
updateSpeakingState
public void updateSpeakingState(int mask) Description copied from interface:MediaConnectionSends speaking state notification to the gateway.- Specified by:
updateSpeakingStatein interfaceMediaConnection- Parameters:
mask- new speaking state
-
getSpeakingMask
public int getSpeakingMask()- Specified by:
getSpeakingMaskin interfaceMediaConnection- Returns:
- speaking flags announced to the gateway when audio playback starts, see
SpeakingFlags.
-
setSpeakingMask
public void setSpeakingMask(int mask) Description copied from interface:MediaConnectionSets speaking flags announced to the gateway when audio playback starts, seeSpeakingFlags. If the connection is currently announced as speaking, the new flags are sent immediately. Defaults toSpeakingFlags.NORMAL.- Specified by:
setSpeakingMaskin interfaceMediaConnection- Parameters:
mask- new speaking flags
-
getDispatcher
-
setConnectionHandler
-
getDAVEManager
-
createDAVEManager
-
destroyDAVEManager
public void destroyDAVEManager()
-