This commit is contained in:
NoLogicAlan committed 2026-05-03 17:15:55 +03:00
1 parent 7fbd83f6e6
commit b7a654fd36
1 file changed
+10 -4
+10 -4
View File
@@ -726,18 +726,24 @@ export default class Player extends EventEmitter {
const onFfmpegError = (err) => { const onFfmpegError = (err) => {
const ffMsg = err?.message ?? String(err); const ffMsg = err?.message ?? String(err);
// "Input stream error: aborted" means NodeLink dropped the HTTP stream
// (e.g. filter PATCH restarted the player before voice state arrived). const isGracefulKill =
// Only treat it as graceful if the track was already close to ending. ffMsg.includes("aborted") ||
if (ffMsg.includes("aborted") || ffMsg.includes("Input stream error")) { ffMsg.includes("Input stream error") ||
ffMsg.includes("SIGKILL") ||
ffMsg.includes("killed with signal");
if (isGracefulKill) {
if (this._didTrackMostlyFinish(currentTrack)) { if (this._didTrackMostlyFinish(currentTrack)) {
logger.player("[Player] FFmpeg stream ended near track completion"); logger.player("[Player] FFmpeg stream ended near track completion");
cleanup(); cleanup();
return resolve(); return resolve();
} }
cleanup(); cleanup();
if (this._streamingStopped || this._skipping) return resolve();
return reject(new Error(`FFmpeg stream ended early: ${ffMsg}`)); return reject(new Error(`FFmpeg stream ended early: ${ffMsg}`));
} }
logger.error("[Player] FFmpeg error:", ffMsg); logger.error("[Player] FFmpeg error:", ffMsg);
cleanup(); cleanup();
if (this._streamingStopped || this._skipping) return resolve(); if (this._streamingStopped || this._skipping) return resolve();