Example of music streaming from disk

This commit is contained in:
Manevolent
2018-12-24 20:32:26 -05:00
parent 7b25be6420
commit 941308d67b
7 changed files with 164 additions and 18 deletions
@@ -536,7 +536,8 @@ public class LocalTeamspeakClientSocket
// Set a state and send a muted event
} else if (microphone.isReady()) {
byte[] data = microphone.provide();
if (data.length <= 0) return;
if (data.length <= 0)
return;
PacketBody0Voice voice = new PacketBody0Voice(getRole().getOut());
@@ -1,31 +1,19 @@
package com.github.manevolent.ts3j;
;
import com.github.manevolent.ts3j.api.Client;
import com.github.manevolent.ts3j.audio.Microphone;
import com.github.manevolent.ts3j.enums.CodecType;
import com.github.manevolent.ts3j.event.*;
import com.github.manevolent.ts3j.identity.LocalIdentity;
import com.github.manevolent.ts3j.protocol.Packet;
import com.github.manevolent.ts3j.protocol.client.ClientConnectionState;
import com.github.manevolent.ts3j.protocol.packet.PacketBody0Voice;
import com.github.manevolent.ts3j.protocol.socket.client.LocalTeamspeakClientSocket;
import com.github.manevolent.ts3j.util.Ts3Debugging;
import java.math.BigInteger;
import java.net.InetSocketAddress;
import java.util.Base64;
import java.util.function.Consumer;
import static org.junit.Assert.assertEquals;
public class ServerConnectionTest {
public static void main(String[] args) throws Exception {
Ts3Debugging.setEnabled(true);
LocalTeamspeakClientSocket client = new LocalTeamspeakClientSocket();
LocalIdentity identity = LocalIdentity.generateNew(10);
LocalTeamspeakClientSocket client = new LocalTeamspeakClientSocket();
client.setIdentity(identity);
client.setNickname(ServerConnectionTest.class.getSimpleName());
client.setHWID("TestTestTest");
@@ -38,6 +26,8 @@ public class ServerConnectionTest {
assertEquals(client.getState(), ClientConnectionState.CONNECTED);
client.subscribeAll();
client.disconnect("BYE");
} catch (Exception ex) {
ex.printStackTrace();