* fix: nextFMTrack 执行顺序

* fix: 当前歌曲无法播放时,播放下一首

* fix: windows下无法创建部分文件

* fix: windows下无法加载sqlite3
This commit is contained in:
memorydream 2022-04-08 14:02:50 +08:00 committed by GitHub
parent 530581ba82
commit 24798a0bf3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 5 deletions

View file

@ -171,7 +171,7 @@ export class Player {
*/
private async _fetchTrack(trackID: TrackID) {
const response = await fetchTracksWithReactQuery({ ids: [trackID] })
return response?.songs.length ? response.songs[0] : null
return response?.songs?.length ? response.songs[0] : null
}
/**
@ -211,6 +211,7 @@ export class Player {
const { audio, id } = await this._fetchAudioSource(this.trackID)
if (!audio) {
toast('无法播放此歌曲')
this.nextTrack()
return
}
if (this.trackID !== id) return
@ -269,11 +270,11 @@ export class Player {
}
}
if (this.fmTrackList.length === 0) await loadMoreTracks()
this.fmTrackList.shift()
if (this.fmTrackList.length === 0) await loadMoreTracks()
this._playTrack()
this.fmTrackList.length === 0 ? await loadMoreTracks() : loadMoreTracks()
this.fmTrackList.length <= 1 ? await loadMoreTracks() : loadMoreTracks()
prefetchNextTrack()
}