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); }