@@ -395,7 +395,6 @@ export const usePlayerStore = defineStore('player', () => {
395
395
const musicFull = ref ( false ) ;
396
396
const favoriteList = ref < Array < number | string > > ( getLocalStorageItem ( 'favoriteList' , [ ] ) ) ;
397
397
const dislikeList = ref < Array < number | string > > ( getLocalStorageItem ( 'dislikeList' , [ ] ) ) ;
398
- const savedPlayProgress = ref < number | undefined > ( ) ;
399
398
const showSleepTimer = ref ( false ) ; // 定时弹窗
400
399
// 添加播放列表抽屉状态
401
400
const playListDrawerVisible = ref ( false ) ;
@@ -1080,7 +1079,6 @@ export const usePlayerStore = defineStore('player', () => {
1080
1079
const settingStore = useSettingsStore ( ) ;
1081
1080
const savedPlayList = getLocalStorageItem ( 'playList' , [ ] ) ;
1082
1081
const savedPlayMusic = getLocalStorageItem < SongResult | null > ( 'currentPlayMusic' , null ) ;
1083
- const savedProgress = localStorage . getItem ( 'playProgress' ) ;
1084
1082
1085
1083
if ( savedPlayList . length > 0 ) {
1086
1084
setPlayList ( savedPlayList ) ;
@@ -1100,20 +1098,6 @@ export const usePlayerStore = defineStore('player', () => {
1100
1098
}
1101
1099
1102
1100
await handlePlayMusic ( { ...savedPlayMusic , isFirstPlay : true , playMusicUrl : undefined } , isPlaying ) ;
1103
-
1104
- if ( savedProgress ) {
1105
- try {
1106
- const progress = JSON . parse ( savedProgress ) ;
1107
- if ( progress && progress . songId === savedPlayMusic . id ) {
1108
- savedPlayProgress . value = progress . progress ;
1109
- } else {
1110
- localStorage . removeItem ( 'playProgress' ) ;
1111
- }
1112
- } catch ( e ) {
1113
- console . error ( '解析保存的播放进度失败' , e ) ;
1114
- localStorage . removeItem ( 'playProgress' ) ;
1115
- }
1116
- }
1117
1101
} catch ( error ) {
1118
1102
console . error ( '重新获取音乐链接失败:' , error ) ;
1119
1103
play . value = false ;
@@ -1200,13 +1184,7 @@ export const usePlayerStore = defineStore('player', () => {
1200
1184
1201
1185
// 播放新音频,传递是否应该播放的状态
1202
1186
console . log ( '调用audioService.play,播放状态:' , shouldPlay ) ;
1203
- const newSound = await audioService . play ( playMusicUrl . value , playMusic . value , shouldPlay ) ;
1204
-
1205
- // 如果有保存的进度,设置播放位置
1206
- if ( initialPosition > 0 ) {
1207
- newSound . seek ( initialPosition ) ;
1208
- }
1209
-
1187
+ const newSound = await audioService . play ( playMusicUrl . value , playMusic . value , shouldPlay , initialPosition || 0 ) ;
1210
1188
// 发布音频就绪事件,让 MusicHook.ts 来处理设置监听器
1211
1189
window . dispatchEvent ( new CustomEvent ( 'audio-ready' , { detail : { sound : newSound , shouldPlay } } ) ) ;
1212
1190
@@ -1343,7 +1321,6 @@ export const usePlayerStore = defineStore('player', () => {
1343
1321
playListIndex,
1344
1322
playMode,
1345
1323
musicFull,
1346
- savedPlayProgress,
1347
1324
favoriteList,
1348
1325
dislikeList,
1349
1326
playListDrawerVisible,
0 commit comments