🐞 fix(player): 修复播放状态判断逻辑

修复在播放相同ID但不同URL的音乐时,播放状态判断逻辑错误的问题。现在只有当音乐ID和URL都相同时才会切换播放/暂停状态。
This commit is contained in:
alger
2025-05-18 12:42:15 +08:00
parent 6d4e6ef214
commit e9fe9000f6

View File

@@ -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();