Skip to content

Commit e9fe900

Browse files
committed
🐞 fix(player): 修复播放状态判断逻辑
修复在播放相同ID但不同URL的音乐时,播放状态判断逻辑错误的问题。现在只有当音乐ID和URL都相同时才会切换播放/暂停状态。
1 parent 6d4e6ef commit e9fe900

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/renderer/store/modules/player.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ export const getSongUrl = async (
119119
// 如果自定义音源解析失败,继续使用正常的获取流程
120120
console.warn('自定义音源解析失败,使用默认音源');
121121
} catch (error) {
122+
console.error('error',error)
122123
console.error('自定义音源解析出错:', error);
123124
}
124125
}
@@ -548,7 +549,7 @@ export const usePlayerStore = defineStore('player', () => {
548549
const setPlay = async (song: SongResult) => {
549550
try {
550551
// 如果是当前正在播放的音乐,则切换播放/暂停状态
551-
if (playMusic.value.id === song.id) {
552+
if (playMusic.value.id === song.id && playMusic.value.playMusicUrl === song.playMusicUrl) {
552553
if (play.value) {
553554
setPlayMusic(false);
554555
audioService.getCurrentSound()?.pause();

0 commit comments

Comments
 (0)