mirror of
https://github.com/jwdeveloper/TikTokLiveJava.git
synced 2026-02-27 08:49:40 -05:00
Moved ActionResult#message to top of toJson() for easier reading
Change Recording settings to accept an output file instead of directory and filename
This commit is contained in:
@@ -87,14 +87,13 @@ public class RecorderListener implements LiveRecorder {
|
||||
connection.setRequestProperty(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
var path = settings.getOutputPath() + File.separator + settings.getOutputFileName();
|
||||
var file = new File(path);
|
||||
var file = settings.getOutputFile();
|
||||
file.getParentFile().mkdirs();
|
||||
file.createNewFile();
|
||||
|
||||
try (
|
||||
var in = connection.getInputStream();
|
||||
var fos = new FileOutputStream(file)
|
||||
var in = connection.getInputStream();
|
||||
var fos = new FileOutputStream(file)
|
||||
) {
|
||||
byte[] dataBuffer = new byte[1024];
|
||||
int bytesRead;
|
||||
@@ -113,11 +112,10 @@ public class RecorderListener implements LiveRecorder {
|
||||
|
||||
var recordingStartedEvent = new TikTokLiveRecorderStartedEvent(downloadData);
|
||||
liveClient.publishEvent(recordingStartedEvent);
|
||||
if (recordingStartedEvent.isCanceled()) {
|
||||
liveClient.getLogger().info("Recording cancelled");
|
||||
return;
|
||||
}
|
||||
liveDownloadThread.start();
|
||||
if (recordingStartedEvent.isCanceled())
|
||||
liveClient.getLogger().info("Recording cancelled");
|
||||
else
|
||||
liveDownloadThread.start();
|
||||
}
|
||||
|
||||
@TikTokEventObserver
|
||||
|
||||
@@ -27,6 +27,7 @@ import io.github.jwdeveloper.tiktok.extension.recorder.impl.enums.LiveFormat;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.function.Function;
|
||||
|
||||
@Getter
|
||||
@@ -36,8 +37,7 @@ public class RecorderSettings {
|
||||
private String ffmpegPath;
|
||||
private String quality;
|
||||
private String format;
|
||||
private String outputPath;
|
||||
private String outputFileName;
|
||||
private File outputFile;
|
||||
private Function<String,DownloadData> prepareDownloadData;
|
||||
private boolean startOnConnected;
|
||||
private boolean stopOnDisconnect = true;
|
||||
|
||||
Reference in New Issue
Block a user