From 858110306c3bee24b97f04c21f74041f0e7ec403 Mon Sep 17 00:00:00 2001 From: daniel-c-harvey Date: Sun, 7 Jun 2026 15:09:48 -0400 Subject: [PATCH] fix: preserve full-track duration after seek-beyond-buffer reinit --- DeepDrftPublic/Interop/audio/AudioPlayer.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/DeepDrftPublic/Interop/audio/AudioPlayer.ts b/DeepDrftPublic/Interop/audio/AudioPlayer.ts index 22d8c8a..cc0a755 100644 --- a/DeepDrftPublic/Interop/audio/AudioPlayer.ts +++ b/DeepDrftPublic/Interop/audio/AudioPlayer.ts @@ -140,9 +140,11 @@ export class AudioPlayer { this.scheduler.addBuffer(result.buffer); } - // Update duration estimate + // Update duration estimate — set once only; reinitializeFromOffset does not + // reset this.duration, so after a seek-beyond-buffer the synthesised header's + // shorter DataSize cannot overwrite the original full-track duration. const estimatedDuration = this.streamDecoder.getEstimatedDuration(); - if (estimatedDuration) { + if (estimatedDuration && this.duration === 0) { this.duration = estimatedDuration; }