Song info, save queue as playlist, sleep timer, resume long tracks

- Song info: format, bitrate, sample rate, channels, size, plays, dates, loudness and location
- Save the current queue as a playlist from the queue drawer
- Sleep timer (15 min to 2 h, or end of this song) that fades out gently;
  "end of this song" stops exactly at the end instead of starting the next one
- Songs over 20 minutes, like DJ mixes, pick up where you left off
This commit is contained in:
Christian
2026-11-19 00:49:41 -05:00
parent 559818fedd
commit 2fafd29c81
8 changed files with 203 additions and 3 deletions
+8 -1
View File
@@ -37,6 +37,7 @@ const Player = {
standbyIndex: -1,
deckNodes: null,
transitionTimer: 0,
stopAfterCurrent: false,
crossfade: 0,
leveling: false,
ctx: null,
@@ -290,7 +291,7 @@ const Player = {
scheduleTransition() {
const a = this.audio;
if (this.transitionTimer || a.paused || this.standbyIndex < 0 || !isFinite(a.duration)) return;
if (this.transitionTimer || this.stopAfterCurrent || a.paused || this.standbyIndex < 0 || !isFinite(a.duration)) return;
const rate = a.playbackRate || 1;
const remaining = (a.duration - a.currentTime) / rate;
const fade = this.fadeFor();
@@ -596,6 +597,12 @@ Player.on = (type, fn) => Player.decks.forEach((el) => el.addEventListener(type,
on("ended", () => {
Player.cancelTransition();
Player.flushListen();
if (Player.stopAfterCurrent) {
Player.stopAfterCurrent = false;
Player.emit("state");
Player.emit("sleep");
return;
}
if (Player.standbyIndex >= 0 && Player.standbyIndex === Player.nextIndex()) Player.load(Player.standbyIndex);
else Player.next(true);
});