mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-07-10 11:57:35 +08:00
fix(player): 合并外部贡献后的集成修复
- PlayBar 下载按钮补 isElectron 守卫,Web 端不再显示无效按钮(#708 评审意见) - preloadNextSongs 恢复 800ms 短去抖,避免快速切歌时音源请求风暴(#712 评审意见) - 清理合并后未使用的导入
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user