Skip to content

Commit 090103b

Browse files
Update audioService.ts
1 parent 5ee60d7 commit 090103b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/renderer/services/audioService.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ class AudioService {
458458
}
459459

460460
// 播放控制相关
461-
play(url?: string, track?: SongResult, isPlay: boolean = true): Promise<Howl> {
461+
play(url?: string, track?: SongResult, isPlay: boolean = true, seekTime: number = 0): Promise<Howl> {
462462
// 每次调用play方法时,尝试强制重置锁(注意:仅在页面刷新后的第一次播放时应用)
463463
if (!this.currentSound) {
464464
console.log('首次播放请求,强制重置操作锁');
@@ -608,6 +608,10 @@ class AudioService {
608608

609609
// 音频加载成功后设置 EQ 和更新媒体会话
610610
if (this.currentSound) {
611+
try {
612+
if (seekTime > 0) {
613+
this.currentSound.seek(seekTime);
614+
}
611615
console.log('audioService: 音频加载成功,设置 EQ');
612616
this.updateMediaSessionMetadata(track);
613617
this.updateMediaSessionPositionState();

0 commit comments

Comments
 (0)