fix(player): 合并外部贡献后的集成修复

- PlayBar 下载按钮补 isElectron 守卫,Web 端不再显示无效按钮(#708 评审意见)
- preloadNextSongs 恢复 800ms 短去抖,避免快速切歌时音源请求风暴(#712 评审意见)
- 清理合并后未使用的导入
This commit is contained in:
alger
2026-07-05 14:00:07 +08:00
parent 8ea13e04f0
commit 837f0268d5
3 changed files with 13 additions and 4 deletions
+11 -1
View File
@@ -107,9 +107,19 @@ export const usePlaylistStore = defineStore(
};
/**
* 智能预加载下一首歌曲(立即执行,不等待)
* 智能预加载下一首歌曲
* 短去抖:快速连续切歌时只保留最后一次,避免对音源 API 的请求风暴
*/
let preloadDebounceTimer: ReturnType<typeof setTimeout> | null = null;
const preloadNextSongs = (currentIndex: number) => {
if (preloadDebounceTimer) clearTimeout(preloadDebounceTimer);
preloadDebounceTimer = setTimeout(() => {
preloadDebounceTimer = null;
doPreloadNextSongs(currentIndex);
}, 800);
};
const doPreloadNextSongs = (currentIndex: number) => {
if (playList.value.length <= 1) return;
let nextIndex: number;