Package org.javacord.core.util.gateway
Class AudioPacket
- java.lang.Object
-
- org.javacord.core.util.gateway.AudioPacket
-
public class AudioPacket extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description AudioPacket(byte[] audioFrame, int ssrc, char sequence, int timestamp)
Creates a new audio packet.AudioPacket(int ssrc, char sequence, int timestamp)
Creates a new silent audio packet.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.net.DatagramPacket
asUdpPacket(java.net.InetSocketAddress address)
Creates aDatagramPacket
, ready to be sent.void
encrypt(byte[] key)
Encrypts the audio packet with the given key.boolean
isEncrypted()
Checks if the audio packet has been encrypted using theencrypt(byte[])
method.
-
-
-
Constructor Detail
-
AudioPacket
public AudioPacket(int ssrc, char sequence, int timestamp)
Creates a new silent audio packet.- Parameters:
ssrc
- The ssrc.sequence
- The sequence.timestamp
- The timestamp.
-
AudioPacket
public AudioPacket(byte[] audioFrame, int ssrc, char sequence, int timestamp)
Creates a new audio packet.- Parameters:
audioFrame
- A byte array containing 20ms of audiossrc
- The ssrc.sequence
- The sequence.timestamp
- The timestamp.
-
-
Method Detail
-
encrypt
public void encrypt(byte[] key)
Encrypts the audio packet with the given key.- Parameters:
key
- The key used to encrypt the packet.
-
asUdpPacket
public java.net.DatagramPacket asUdpPacket(java.net.InetSocketAddress address)
Creates aDatagramPacket
, ready to be sent.- Parameters:
address
- The destination address.- Returns:
- The created datagram packet.
-
isEncrypted
public boolean isEncrypted()
Checks if the audio packet has been encrypted using theencrypt(byte[])
method.- Returns:
- Whether the audio packet is encrypted or not.
-
-