filter workss

This commit is contained in:
NoLogicAlan committed 2026-05-05 21:22:35 +03:00
1 parent 0bdc37fa73
commit 2f0cdc6b9a
2 files changed
+8 -2

No files matched your search

+1 -1
View File
@@ -11,7 +11,7 @@
"genius-lyrics": "^4.4.3", "genius-lyrics": "^4.4.3",
"moonlink.js": "^5.2.0", "moonlink.js": "^5.2.0",
"mysql": "^2.18.1", "mysql": "^2.18.1",
"revoice.js": "^0.2.1694", "revoice.js": "^0.2.1696",
"util": "^0.12.5", "util": "^0.12.5",
"ws": "^8.19.0" "ws": "^8.19.0"
}, },
+7 -1
View File
@@ -1480,7 +1480,13 @@ export default class Player extends EventEmitter {
// Restart the current stream so the loadstream URL picks up the new filters. // Restart the current stream so the loadstream URL picks up the new filters.
// The PATCH only updates NodeLink's player state — it does NOT modify the // The PATCH only updates NodeLink's player state — it does NOT modify the
// currently-streaming PCM pipe. Without restarting, the audio won't change. // currently-streaming PCM pipe. Without restarting, the audio won't change.
if (current?.encoded && this.connection && !this.leaving && !this._streamingStopped) { //
// Guard: only restart if we're mid-playback (startedPlaying is set) AND
// _doPlayNext is NOT in progress. When _doPlayNext calls applyFilter()
// before starting a new track, startedPlaying hasn't been set yet and
// _doPlayNext itself handles the stream — firing _replayWithFilters here
// would cause the same song to play twice simultaneously.
if (current?.encoded && this.connection && !this.leaving && !this._streamingStopped && this.startedPlaying && !this._playingNext) {
const elapsed = this.startedPlaying ? (Date.now() - this.startedPlaying) : 0; const elapsed = this.startedPlaying ? (Date.now() - this.startedPlaying) : 0;
const positionMs = Math.max(0, elapsed); const positionMs = Math.max(0, elapsed);
logger.player(`[Player] Filter applied — restarting stream from ${positionMs}ms`); logger.player(`[Player] Filter applied — restarting stream from ${positionMs}ms`);