优化临时播放逻辑

This commit is contained in:
lyswhut
2023-01-11 09:28:31 +08:00
parent bf310adc12
commit 9cc36e2a6a
11 changed files with 20 additions and 14 deletions
@@ -9,6 +9,7 @@ import { dataVerify, qualityFilter, sources } from './utils'
import { focusWindow } from '@renderer/utils/ipc'
import { playNext } from '@renderer/core/player/action'
import { toNewMusicInfo } from '@common/utils/tools'
import { LIST_IDS } from '@common/constants'
const useSearchMusic = () => {
const router = useRouter()
@@ -153,7 +154,7 @@ const usePlayMusic = () => {
musicInfo = toNewMusicInfo(musicInfo)
markRaw(musicInfo)
const isPlaying = !!playMusicInfo.musicInfo
addTempPlayList([{ listId: '__temp__', musicInfo, isTop: true }])
addTempPlayList([{ listId: LIST_IDS.PLAY_LATER, musicInfo, isTop: true }])
if (isPlaying) playNext()
}
}
@@ -107,7 +107,7 @@ export default () => {
setMaxplayTime(getDuration())
if (playMusicInfo.musicInfo && 'source' in playMusicInfo.musicInfo && !playMusicInfo.musicInfo.interval) {
console.log(formatPlayTime2(playProgress.maxPlayTime))
// console.log(formatPlayTime2(playProgress.maxPlayTime))
if (playMusicInfo.listId) {
void updateListMusics([{
@@ -9,7 +9,7 @@ const changedListIds = new Set<string | null>()
export default () => {
const throttleListChange = throttle(() => {
const isSkip = !changedListIds.has(playInfo.playerListId) && !changedListIds.has(playMusicInfo.listId)
const isSkip = playMusicInfo.listId && !changedListIds.has(playInfo.playerListId) && !changedListIds.has(playMusicInfo.listId)
changedListIds.clear()
if (isSkip) return