更新弹幕、直播的下载,以及弹幕的转换还有部分接口

This commit is contained in:
2024-10-25 17:31:14 +08:00
parent ac7f076721
commit 590c54b777
35 changed files with 1197 additions and 151 deletions

View File

@@ -27,6 +27,8 @@ import java.util.concurrent.TimeUnit;
@Service
public class SystemService {
@Resource
LiveVideoService videoService;
SystemConfigDatabases databases = new SystemConfigDatabases();
private ScheduledExecutorService timer;
private ScheduledFuture<?> scheduled;
@@ -50,6 +52,7 @@ public class SystemService {
}
scheduled = timer.scheduleAtFixedRate(() -> {
List<LiveConfigDatabaseBean> list = liveConfigDatabase.getAllConfig();
System.out.println("循环任务:"+list.size());
for (LiveConfigDatabaseBean bean : list) {
if (bean.isRecordDanmu() && bean.checkRecordDanmuTime()) {
recordDanmu(bean);
@@ -60,7 +63,10 @@ public class SystemService {
}
}, 0, getLoopTimer(), TimeUnit.MILLISECONDS);
}
public void stop() {
scheduled.cancel(true);
videoService.stopAll();
}
// 录制弹幕
private void recordDanmu(LiveConfigDatabaseBean bean) {
LiveRoomConfig config = new LiveRoomConfig();
@@ -68,12 +74,13 @@ public class SystemService {
config.setRoomId(bean.getRoomId());
config.setAnchorName(bean.getAnchorName());
config.setLogin(StringUtils.hasText(bean.getRecordUid()));
WebSocketManager.getInstance().addRoom(config);
config.setRootPath(bean.getRecordPath());
WebSocketManager.getInstance().addRoom(config,false);
}
// 录制视频
private void recordVideo(LiveConfigDatabaseBean bean) {
videoService.start(bean, false);
}
public static void main(String[] args) throws InterruptedException {
@@ -85,4 +92,5 @@ public class SystemService {
service.start();
}
}