mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-04-23 15:47:23 +08:00
✨ feat: 重构播放控制逻辑,添加播放进度恢复功能并清理无用代码
This commit is contained in:
@@ -456,7 +456,7 @@ class AudioService {
|
||||
}
|
||||
|
||||
// 播放控制相关
|
||||
play(url?: string, track?: SongResult, isPlay: boolean = true): Promise<Howl> {
|
||||
play(url?: string, track?: SongResult, isPlay: boolean = true, seekTime: number = 0): Promise<Howl> {
|
||||
// 每次调用play方法时,尝试强制重置锁(注意:仅在页面刷新后的第一次播放时应用)
|
||||
if (!this.currentSound) {
|
||||
console.log('首次播放请求,强制重置操作锁');
|
||||
@@ -599,6 +599,9 @@ class AudioService {
|
||||
// 音频加载成功后设置 EQ 和更新媒体会话
|
||||
if (this.currentSound) {
|
||||
try {
|
||||
if (seekTime > 0) {
|
||||
this.currentSound.seek(seekTime);
|
||||
}
|
||||
console.log('audioService: 音频加载成功,设置 EQ');
|
||||
await this.setupEQ(this.currentSound);
|
||||
this.updateMediaSessionMetadata(track);
|
||||
|
||||
Reference in New Issue
Block a user