mirror of
https://github.com/pvrzz/atmosphere.git
synced 2026-11-29 05:22:26 +00:00
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:
+8
-1
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user