feat: 重构播放控制逻辑,添加播放进度恢复功能并清理无用代码

This commit is contained in:
algerkong
2025-06-11 20:12:52 +08:00
parent d227ac8b34
commit b9c38d257a
3 changed files with 5 additions and 43 deletions
-18
View File
@@ -873,24 +873,6 @@ export const initAudioListeners = async () => {
if (finalSound) {
// 更新全局 sound 引用
sound.value = finalSound;
// 如果当前处于播放状态,启动进度更新
if (playerStore.play) {
// 如果有保存的播放进度,应用它
if (playerStore.savedPlayProgress !== undefined) {
try {
// 设置音频位置
finalSound.seek(playerStore.savedPlayProgress);
// 同时更新时间显示
nowTime.value = playerStore.savedPlayProgress;
console.log('恢复播放进度:', playerStore.savedPlayProgress);
} catch (e) {
console.error('恢复播放进度失败:', e);
}
}
startProgressAnimation();
}
} else {
console.warn('无法获取音频实例,跳过进度更新初始化');
}