From 009f565b736356bdf3eb5bcc917671b19409c8aa Mon Sep 17 00:00:00 2001 From: daniel-c-harvey Date: Thu, 11 Jun 2026 06:13:52 -0400 Subject: [PATCH] fix: remove dead CalculateByteOffset C# shim; guard AudioPlayer.calculateByteOffset on parsed format --- .../Services/AudioInteropService.cs | 12 ------------ DeepDrftPublic/Interop/audio/AudioPlayer.ts | 1 + 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/DeepDrftPublic.Client/Services/AudioInteropService.cs b/DeepDrftPublic.Client/Services/AudioInteropService.cs index f7e1f1f..48ea050 100644 --- a/DeepDrftPublic.Client/Services/AudioInteropService.cs +++ b/DeepDrftPublic.Client/Services/AudioInteropService.cs @@ -128,18 +128,6 @@ public class AudioInteropService : IAsyncDisposable } } - public async Task CalculateByteOffset(string playerId, double positionSeconds) - { - try - { - return (long)await _jsRuntime.InvokeAsync("DeepDrftAudio.calculateByteOffset", playerId, positionSeconds); - } - catch - { - return 0; - } - } - public async Task ReinitializeFromOffset(string playerId, long totalStreamLength, double seekPosition) { return await InvokeJsAsync("DeepDrftAudio.reinitializeFromOffset", playerId, totalStreamLength, seekPosition); diff --git a/DeepDrftPublic/Interop/audio/AudioPlayer.ts b/DeepDrftPublic/Interop/audio/AudioPlayer.ts index 92bdbf7..0ec05f6 100644 --- a/DeepDrftPublic/Interop/audio/AudioPlayer.ts +++ b/DeepDrftPublic/Interop/audio/AudioPlayer.ts @@ -367,6 +367,7 @@ export class AudioPlayer { * Calculate byte offset for a time position (for C# layer) */ calculateByteOffset(positionSeconds: number): number { + if (!this.streamDecoder.getFormatInfo()) return 0; return this.streamDecoder.calculateByteOffset(positionSeconds); }