added loop
This commit is contained in:
@@ -7,7 +7,14 @@ import { add_to_history } from "./util/history";
|
||||
|
||||
const queue: Queue = {
|
||||
songList: [],
|
||||
current: null
|
||||
current: null,
|
||||
loop: null,
|
||||
}
|
||||
|
||||
export function toggleLoop(): AudioFile | null {
|
||||
if (queue.loop) queue.loop = null
|
||||
else queue.loop = queue.current
|
||||
return queue.loop
|
||||
}
|
||||
|
||||
export async function requestSong(
|
||||
@@ -36,7 +43,7 @@ export async function forceRequestSong(
|
||||
|
||||
export async function updatePlayer() {
|
||||
if (player.state.status === AudioPlayerStatus.Idle) {
|
||||
const nextSong = queue.songList.shift()
|
||||
const nextSong = queue.loop ?? queue.songList.shift()
|
||||
if (!nextSong) {
|
||||
queue.current = null
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user