[O] Auto prepare next song

This commit is contained in:
2025-11-23 14:58:12 +08:00
parent 2927243237
commit aa8d61a8ac
2 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ Practice Japanese Karaoke lyrics reading and typing at the same time with KaraDa
* [x] 唱歌模式
* [x] 自动分离人声和伴奏
* [ ] 分段处理以加快初始加载速度
* [ ] 自动预处理下一首歌
* [x] 自动预处理下一首歌
* [x] 调节人声伴奏比例
* [x] 跟随音乐滚动歌词
* [ ] 升降调
+5 -1
View File
@@ -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)
}