feat: stop on next song + start on empty queue

This commit is contained in:
Mat12143 2025-08-02 11:49:49 +02:00
parent 7e52746b37
commit 350f44b194
3 changed files with 12 additions and 10 deletions

View file

@ -52,6 +52,10 @@
queueSongs = songs queueSongs = songs
playingIndex = index playingIndex = index
if (queueSongs.length == 0) {
playNext()
}
}) })
$effect(() => { $effect(() => {
@ -72,6 +76,11 @@
queueSongs = songs queueSongs = songs
playingIndex = index playingIndex = index
if (audioController) {
audioController.pause()
audioController.currentTime = 0
}
} }
function seek(e: Event) { function seek(e: Event) {

View file

@ -9,7 +9,6 @@
import type { FetchError } from "$lib/types.js" import type { FetchError } from "$lib/types.js"
import { io, Socket } from "socket.io-client" import { io, Socket } from "socket.io-client"
import { get_coords } from "$lib/gps.js" import { get_coords } from "$lib/gps.js"
import type { Coordinates } from "$lib/gps.js"
let { data } = $props() let { data } = $props()

View file

@ -1,13 +1,7 @@
import { error, type Load, type ServerLoad } from "@sveltejs/kit"
import type { PageLoad } from "./$types" import type { PageLoad } from "./$types"
import type { FetchError } from "$lib/util"
import { parseSuggestion, type Suggestion } from "$lib/types"
export const load: PageLoad = async ({ params }) => { export const load: PageLoad = ({ params, url }) => {
if (params.id) { return {
return { roomId: params.id || "",
roomId: params.id,
}
} }
error(400, "Please provide a room id")
} }