mirror of
https://github.com/jwdeveloper/TikTokLiveJava.git
synced 2026-02-27 16:59:39 -05:00
Update example project
This commit is contained in:
@@ -38,4 +38,6 @@ public class ParseMessagesTests extends TikTokBaseTest
|
||||
var bytes = getFileBytesUtf("MessageWebcastSocialMessage.bin");
|
||||
var message = WebcastSocialMessage.parseFrom(bytes);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package io.github.jwdeveloper.tiktok;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.Duration;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class ConfigurationExample
|
||||
{
|
||||
public static void main(String[] args) throws IOException {
|
||||
|
||||
TikTokLive.newClient(Main.TEST_TIKTOK_USER)
|
||||
.configure(clientSettings ->
|
||||
{
|
||||
clientSettings.setHostName(Main.TEST_TIKTOK_USER); //tiktok user
|
||||
clientSettings.setClientLanguage("en"); //language
|
||||
clientSettings.setTimeout(Duration.ofSeconds(2)); //connection timeout
|
||||
clientSettings.setLogLevel(Level.ALL); //log level
|
||||
clientSettings.setDownloadGiftInfo(true); //TODO
|
||||
clientSettings.setCheckForUnparsedData(true); //TODO
|
||||
clientSettings.setPollingInterval(Duration.ofSeconds(1)); //TODO
|
||||
clientSettings.setPrintMessageData(true); //TODO
|
||||
clientSettings.setPrintToConsole(true); //TODO
|
||||
clientSettings.setHandleExistingMessagesOnConnect(true); //TODO
|
||||
clientSettings.setRetryOnConnectionFailure(true); //TODO
|
||||
})
|
||||
.buildAndRun();
|
||||
System.in.read();
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,10 @@ import java.io.IOException;
|
||||
|
||||
public class Main {
|
||||
|
||||
public static String TEST_USER_SUBJECT = "mr_cios";
|
||||
public static String TEST_TIKTOK_USER = "mr_cios";
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
var client = TikTokLive.newClient(TEST_USER_SUBJECT)
|
||||
var client = TikTokLive.newClient(TEST_TIKTOK_USER)
|
||||
.onConnected(Main::onConnected)
|
||||
.onDisconnected(Main::onDisconnected)
|
||||
.onRoomViewerData(Main::onViewerData)
|
||||
|
||||
@@ -4,13 +4,8 @@ import java.io.IOException;
|
||||
|
||||
public class SimpleExample {
|
||||
public static void main(String[] args) throws IOException {
|
||||
// Username of someone who is currently live
|
||||
var tiktokUsername = "mr_cios";
|
||||
|
||||
TikTokLive.newClient(tiktokUsername)
|
||||
.configure(settings ->
|
||||
{
|
||||
})
|
||||
TikTokLive.newClient(Main.TEST_TIKTOK_USER)
|
||||
.onConnected(event ->
|
||||
{
|
||||
System.out.println("Connected");
|
||||
@@ -25,6 +20,7 @@ public class SimpleExample {
|
||||
})
|
||||
.onError(event ->
|
||||
{
|
||||
System.out.println("OTO tajeminica wiary");
|
||||
event.getException().printStackTrace();
|
||||
})
|
||||
.buildAndRun();
|
||||
|
||||
Reference in New Issue
Block a user