From e9fe9000f6c1353193d8b87b909a1f8aeeffe179 Mon Sep 17 00:00:00 2001 From: alger Date: Sun, 18 May 2025 12:42:15 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix(player):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=92=AD=E6=94=BE=E7=8A=B6=E6=80=81=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复在播放相同ID但不同URL的音乐时,播放状态判断逻辑错误的问题。现在只有当音乐ID和URL都相同时才会切换播放/暂停状态。 --- src/renderer/store/modules/player.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/renderer/store/modules/player.ts b/src/renderer/store/modules/player.ts index 7e51df1..7994031 100644 --- a/src/renderer/store/modules/player.ts +++ b/src/renderer/store/modules/player.ts @@ -119,6 +119,7 @@ export const getSongUrl = async ( // 如果自定义音源解析失败,继续使用正常的获取流程 console.warn('自定义音源解析失败,使用默认音源'); } catch (error) { + console.error('error',error) console.error('自定义音源解析出错:', error); } } @@ -548,7 +549,7 @@ export const usePlayerStore = defineStore('player', () => { const setPlay = async (song: SongResult) => { try { // 如果是当前正在播放的音乐,则切换播放/暂停状态 - if (playMusic.value.id === song.id) { + if (playMusic.value.id === song.id && playMusic.value.playMusicUrl === song.playMusicUrl) { if (play.value) { setPlayMusic(false); audioService.getCurrentSound()?.pause();