feat: 优化播放错误处理

This commit is contained in:
alger
2025-12-17 13:19:10 +08:00
parent 89c6b11110
commit 6bc168c5bd
9 changed files with 60 additions and 57 deletions
+1 -27
View File
@@ -314,20 +314,6 @@ export const usePlayerCoreStore = defineStore(
}
playbackRequestManager.failRequest(requestId);
// 通知外部播放失败,需要跳到下一首
try {
const { usePlaylistStore } = await import('./playlist');
const playlistStore = usePlaylistStore();
if (Array.isArray(playlistStore.playList) && playlistStore.playList.length > 1) {
message.warning('歌曲解析失败 播放下一首');
setTimeout(() => {
playlistStore.nextPlay();
}, 500);
}
} catch (e) {
console.warn('切换下一首时发生问题:', e);
}
return false;
}
};
@@ -458,19 +444,7 @@ export const usePlayerCoreStore = defineStore(
}
}, 1000);
} else {
// 非操作锁错误:尝试切到下一首,避免在解析失败时卡住
message.warning('歌曲解析失败 播放下一首');
try {
const { usePlaylistStore } = await import('./playlist');
const playlistStore = usePlaylistStore();
if (Array.isArray(playlistStore.playList) && playlistStore.playList.length > 1) {
setTimeout(() => {
playlistStore.nextPlay();
}, 500);
}
} catch (e) {
console.warn('播放失败回退到下一首时发生问题(可能依赖未加载):', e);
}
console.warn('播放音频失败(非操作锁错误),由调用方处理重试');
}
message.error(i18n.global.t('player.playFailed'));