[O] Auto prepare next song
This commit is contained in:
@@ -16,7 +16,7 @@ Practice Japanese Karaoke lyrics reading and typing at the same time with KaraDa
|
|||||||
* [x] 唱歌模式
|
* [x] 唱歌模式
|
||||||
* [x] 自动分离人声和伴奏
|
* [x] 自动分离人声和伴奏
|
||||||
* [ ] 分段处理以加快初始加载速度
|
* [ ] 分段处理以加快初始加载速度
|
||||||
* [ ] 自动预处理下一首歌
|
* [x] 自动预处理下一首歌
|
||||||
* [x] 调节人声伴奏比例
|
* [x] 调节人声伴奏比例
|
||||||
* [x] 跟随音乐滚动歌词
|
* [x] 跟随音乐滚动歌词
|
||||||
* [ ] 升降调
|
* [ ] 升降调
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
import { artistAndAlbum } from "$lib/utils"
|
import { artistAndAlbum } from "$lib/utils"
|
||||||
import { getI18n } from "$lib/i18n"
|
import { getI18n } from "$lib/i18n"
|
||||||
import { typingSettingsDefault } from "$lib/types"
|
import { typingSettingsDefault } from "$lib/types"
|
||||||
|
import { getNextSong } from "$lib/ui/player/SongSwitching.js";
|
||||||
|
|
||||||
const t = getI18n().song.mode
|
const t = getI18n().song.mode
|
||||||
|
|
||||||
@@ -41,6 +42,9 @@
|
|||||||
|
|
||||||
async function startLoading() {
|
async function startLoading() {
|
||||||
await API.song.prepare(data.song.id)
|
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 interval = setInterval(async () => {
|
||||||
const res = await API.song.status(data.song.id)
|
const res = await API.song.status(data.song.id)
|
||||||
const state = res.status
|
const state = res.status
|
||||||
@@ -70,7 +74,7 @@
|
|||||||
clearInterval(interval)
|
clearInterval(interval)
|
||||||
progressPercentage = 100
|
progressPercentage = 100
|
||||||
} else if (state.status === "error") {
|
} else if (state.status === "error") {
|
||||||
clearInterval(interval)
|
clearInterval(interval)
|
||||||
}
|
}
|
||||||
}, 1000)
|
}, 1000)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user