diff --git a/src/renderer/core/player/action.ts b/src/renderer/core/player/action.ts index eee0e7b6..e6620bb9 100644 --- a/src/renderer/core/player/action.ts +++ b/src/renderer/core/player/action.ts @@ -196,6 +196,7 @@ const handlePlay = () => { */ export const playList = (listId: string, index: number) => { setPlayListId(listId) + pause() setPlayMusicInfo(listId, getList(listId)[index]) clearPlayedList() clearTempPlayeList() @@ -218,6 +219,7 @@ export const playNext = async(isAutoToggle = false): Promise => { if (tempPlayList.length) { // 如果稍后播放列表存在歌曲则直接播放改列表的歌曲 const playMusicInfo = tempPlayList[0] removeTempPlayList(0) + pause() setPlayMusicInfo(playMusicInfo.listId, playMusicInfo.musicInfo, playMusicInfo.isTempPlay) handlePlay() return @@ -258,6 +260,7 @@ export const playNext = async(isAutoToggle = false): Promise => { if (index < playedList.length) { const playMusicInfo = playedList[index] + pause() setPlayMusicInfo(playMusicInfo.listId, playMusicInfo.musicInfo, playMusicInfo.isTempPlay) handlePlay() return @@ -312,6 +315,7 @@ export const playNext = async(isAutoToggle = false): Promise => { isTempPlay: false, } + pause() setPlayMusicInfo(nextPlayMusicInfo.listId, nextPlayMusicInfo.musicInfo) handlePlay() } @@ -354,6 +358,7 @@ export const playPrev = async(isAutoToggle = false): Promise => { if (index > -1) { const playMusicInfo = playedList[index] + pause() setPlayMusicInfo(playMusicInfo.listId, playMusicInfo.musicInfo, playMusicInfo.isTempPlay) handlePlay() return @@ -408,6 +413,7 @@ export const playPrev = async(isAutoToggle = false): Promise => { isTempPlay: false, } + pause() setPlayMusicInfo(nextPlayMusicInfo.listId, nextPlayMusicInfo.musicInfo) handlePlay() }