diff --git a/src/routes/song/[id]/karaoke/+page.server.ts b/src/routes/song/[id]/karaoke/+page.server.ts new file mode 100644 index 0000000..a6bca0a --- /dev/null +++ b/src/routes/song/[id]/karaoke/+page.server.ts @@ -0,0 +1,16 @@ +import type { PageServerLoad } from './$types' +import { getLyricsProcessed, getSongRaw, getSongUrl, checkLyricsProcessed } from "$lib/server/songs.ts" +import { redirect } from '@sveltejs/kit' + +export const load: PageServerLoad = async ({ params }) => { + const songId = +params.id + const song = await getSongRaw(songId) + const hasLrc = await checkLyricsProcessed(songId) + + if (!hasLrc) throw redirect(302, `/song/${songId}`) + + const lrc = await getLyricsProcessed(songId)! + const audioData = await getSongUrl(songId) + + return { song, lrc, audioData } +} diff --git a/src/routes/song/[id]/karaoke/+page.svelte b/src/routes/song/[id]/karaoke/+page.svelte new file mode 100644 index 0000000..eea01f8 --- /dev/null +++ b/src/routes/song/[id]/karaoke/+page.svelte @@ -0,0 +1,101 @@ + + + musicControl?.ready()} onkeydown={() => musicControl?.ready()}/> + + + +
+ {#if data.audioData.vocalsUrl} +
+
+ +
{vocalsVolume}%
+
+ {:else} +
+ 未检测到人声分离音轨,无法调节人声音量。请先在歌曲详情页进行处理。 +
+ {/if} +
+ +