mirror of
https://github.com/ZHANGTIANYAO1/teamspeak-music-bot.git
synced 2026-10-01 20:42:50 +08:00
feat: implement seeking (FFmpeg -ss restart), fix lyrics sync with seekOffset
- AudioPlayer.seek() restarts FFmpeg with -ss parameter for actual seeking - New POST /api/player/:botId/seek endpoint - BotStatus includes seekOffset and playStartTime from server - Frontend elapsed = seekOffset + (now - playStartedAt) - Progress bar click now seeks to clicked position - All timing actions use _resetTiming() helper with seekOffset - Lyrics sync uses store.elapsed which includes seekOffset Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
080c2836c9
commit
1cdface33c
5 files changed
+101
-50
No files matched your search
@@ -104,6 +104,22 @@ export function createPlayerRouter(
|
||||
}
|
||||
});
|
||||
|
||||
// Seek to position
|
||||
router.post("/:botId/seek", async (req, res) => {
|
||||
try {
|
||||
const bot = (req as any).bot;
|
||||
const { position } = req.body; // seconds
|
||||
if (typeof position !== "number" || position < 0) {
|
||||
res.status(400).json({ error: "position (seconds) is required" });
|
||||
return;
|
||||
}
|
||||
bot.getPlayer().seek(position);
|
||||
res.json({ message: `Seeked to ${Math.floor(position)}s`, seekOffset: position });
|
||||
} catch (err) {
|
||||
res.status(500).json({ error: (err as Error).message });
|
||||
}
|
||||
});
|
||||
|
||||
router.get("/:botId/queue", (req, res) => {
|
||||
const bot = (req as any).bot;
|
||||
res.json({ queue: bot.getQueue(), status: bot.getStatus() });
|
||||
|
||||
Reference in new issue
Block a user