feat(music): implement instant track transitions via next-up pre-fetching

- Queue: add peek() to inspect the upcoming track while respecting loop modes
- PlaybackMixin: schedule pre-fetch 15s before the current track finishes
- PlaybackMixin: pre-resolve Lavalink tracks and NodeLink trackstream URLs in background
- Player: trigger pre-fetching on queue add events near track completion and clear timers on stop
- FluxerAudioBridge: consume cached direct stream URLs for 0ms track transition latency
This commit is contained in:
NoLogicAlan committed 2026-11-20 15:09:18 +03:00
1 parent 1cfe577055
commit e501fc62fb
4 files changed
+128 -2

No files matched your search

+7 -1
View File
@@ -437,7 +437,13 @@ export class FluxerAudioBridge extends EventEmitter {
let direct;
try {
direct = await this._getTrackstreamUrl(trackInfo);
if (trackInfo._prefetchedDirect && (Date.now() - (trackInfo._prefetchedDirect.cachedAt || 0) < 60_000)) {
direct = trackInfo._prefetchedDirect;
trackInfo._prefetchedDirect = null;
logger.player("[AudioBridge] Using pre-fetched trackstream direct URL: " + (trackInfo.title || "unknown"));
} else {
direct = await this._getTrackstreamUrl(trackInfo);
}
if (!direct?.url) throw new Error("trackstream returned no URL");
} catch (e) {
if (stale()) return "stopped";