mirror of
https://github.com/ZHANGTIANYAO1/teamspeak-music-bot.git
synced 2026-12-01 02:12:50 +08:00
fix(audio): prevent pops during playback controls
This commit is contained in:
1 parent
c26998d296
commit
a0f0b49a4e
3 files changed
+79
-18
No files matched your search
@@ -285,7 +285,7 @@ export function createPlayerRouter(
|
||||
if (index >= queue.size()) {
|
||||
return { status: 400 as const, body: { error: "Invalid queue index" } };
|
||||
}
|
||||
bot.getPlayer().stop();
|
||||
bot.getPlayer().stop(true);
|
||||
bot.getPlayer().resetFailures();
|
||||
const song = queue.playAt(index);
|
||||
if (!song) {
|
||||
@@ -293,6 +293,7 @@ export function createPlayerRouter(
|
||||
}
|
||||
const ok = await bot.resolveAndPlay(song);
|
||||
if (!ok) {
|
||||
bot.getPlayer().stop();
|
||||
return { body: { message: `Cannot play: ${song.name}` } };
|
||||
}
|
||||
return { body: { message: `Now playing: ${song.name} - ${song.artist}` } };
|
||||
|
||||
Reference in new issue
Block a user