fix(core): sidebar audio player seek position issue (#11844)

fix AF-2541
This commit is contained in:
pengx17
2025-04-21 07:52:01 +00:00
parent 2bd9cfe20a
commit 1efcd480af
@@ -188,8 +188,7 @@ export class AudioMediaManagerService extends Service {
if (!stats || !currentState) { if (!stats || !currentState) {
return; return;
} }
const seekOffset = const seekOffset = currentState.seekOffset;
currentState.seekOffset + (Date.now() - currentState.updateTime) / 1000;
this.globalMediaState.updatePlaybackState({ this.globalMediaState.updatePlaybackState({
state: 'playing', state: 'playing',
// rewind to the beginning if the seek offset is greater than the duration // rewind to the beginning if the seek offset is greater than the duration
@@ -207,7 +206,9 @@ export class AudioMediaManagerService extends Service {
this.globalMediaState.updatePlaybackState({ this.globalMediaState.updatePlaybackState({
state: 'paused', state: 'paused',
seekOffset: (Date.now() - state.updateTime) / 1000 + state.seekOffset, seekOffset:
((Date.now() - state.updateTime) / 1000) * (state.playbackRate || 1.0) +
state.seekOffset,
updateTime: Date.now(), updateTime: Date.now(),
}); });
} }