From c5fdf12ef4ecfe6dc2df1b3b6f73335884c5d01a Mon Sep 17 00:00:00 2001 From: daniel-c-harvey Date: Sun, 7 Dec 2025 04:54:05 -0500 Subject: [PATCH] Smooth Seeking (no scrub audio) --- .../AudioPlayerBar/AudioPlayerBar.razor | 37 ++++++++++++------- .../AudioPlayerBar/AudioPlayerBar.razor.cs | 27 ++++++++++++-- 2 files changed, 46 insertions(+), 18 deletions(-) diff --git a/DeepDrftWeb.Client/Controls/AudioPlayerBar/AudioPlayerBar.razor b/DeepDrftWeb.Client/Controls/AudioPlayerBar/AudioPlayerBar.razor index 7f09ef6..3276f04 100644 --- a/DeepDrftWeb.Client/Controls/AudioPlayerBar/AudioPlayerBar.razor +++ b/DeepDrftWeb.Client/Controls/AudioPlayerBar/AudioPlayerBar.razor @@ -32,16 +32,20 @@ else Indeterminate="@(LoadProgress == 0)"/> } - + - -
+ +
@@ -67,19 +71,24 @@ else Indeterminate="@(LoadProgress == 0)"/> }
- + - +
+ +
- + @* Control Buttons - positioned absolutely like original *@
PlayerService.IsLoaded; private bool IsLoading => PlayerService.IsLoading; private bool IsStreaming => PlayerService.CanStartStreaming; private bool IsStreamingMode => PlayerService.IsStreamingMode; private bool IsPlaying => PlayerService.IsPlaying; private bool IsPaused => PlayerService.IsPaused; - private double CurrentTime => PlayerService.CurrentTime; private double? Duration => PlayerService.Duration; private double Volume => PlayerService.Volume; private double LoadProgress => PlayerService.LoadProgress; private string? ErrorMessage => PlayerService.ErrorMessage; + /// + /// Display time - shows seek position while dragging, otherwise current playback time. + /// + private double DisplayTime => _isSeeking ? _seekPosition : PlayerService.CurrentTime; + /// /// Seek is enabled once track is loaded AND duration is known (from WAV header). /// This allows seeking even during streaming, including seeking beyond buffered content. @@ -74,8 +80,21 @@ public partial class AudioPlayerBar : ComponentBase await PlayerService.Stop(); } - private async Task OnSeek(double position) + private void OnSeekStart() { + _isSeeking = true; + _seekPosition = PlayerService.CurrentTime; + } + + private void OnSeekChange(double position) + { + _seekPosition = position; + StateHasChanged(); + } + + private async Task OnSeekEnd(double position) + { + _isSeeking = false; await PlayerService.Seek(position); }