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

View File

@@ -188,8 +188,7 @@ export class AudioMediaManagerService extends Service {
if (!stats || !currentState) {
return;
}
const seekOffset =
currentState.seekOffset + (Date.now() - currentState.updateTime) / 1000;
const seekOffset = currentState.seekOffset;
this.globalMediaState.updatePlaybackState({
state: 'playing',
// 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({
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(),
});
}