diff --git a/README.md b/README.md index 88d3f94..a745bab 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Practice Japanese Karaoke lyrics reading and typing at the same time with KaraDa * [x] 唱歌模式 * [x] 自动分离人声和伴奏 * [ ] 分段处理以加快初始加载速度 - * [ ] 自动预处理下一首歌 + * [x] 自动预处理下一首歌 * [x] 调节人声伴奏比例 * [x] 跟随音乐滚动歌词 * [ ] 升降调 diff --git a/src/routes/song/[id]/+page.svelte b/src/routes/song/[id]/+page.svelte index 3b56631..07af0a2 100644 --- a/src/routes/song/[id]/+page.svelte +++ b/src/routes/song/[id]/+page.svelte @@ -8,6 +8,7 @@ import { artistAndAlbum } from "$lib/utils" import { getI18n } from "$lib/i18n" import { typingSettingsDefault } from "$lib/types" + import { getNextSong } from "$lib/ui/player/SongSwitching.js"; const t = getI18n().song.mode @@ -41,6 +42,9 @@ async function startLoading() { await API.song.prepare(data.song.id) + + // Auto prepare next song + await getNextSong(data.playlist, data.user.data.loc)?.let(async next => await API.song.prepare(next)) const interval = setInterval(async () => { const res = await API.song.status(data.song.id) const state = res.status @@ -70,7 +74,7 @@ clearInterval(interval) progressPercentage = 100 } else if (state.status === "error") { - clearInterval(interval) + clearInterval(interval) } }, 1000) }