Front End Work

- Redesign component wiring for audio playback
 - Removed playback logic from the player control and moved it to injectable audio player engine service
 - Chunked/buffered stream loading from Content API passed to Web Audio API playback in 8K blocks
This commit is contained in:
daniel-c-harvey
2025-09-06 13:39:26 -04:00
parent 3766d4e010
commit 66d800bd26
21 changed files with 519 additions and 907 deletions
+20 -2
View File
@@ -2,6 +2,18 @@ using Microsoft.Extensions.DependencyInjection;
namespace DeepDrftWeb.Client.Clients;
public class TrackMediaResponse
{
public Stream Stream { get; }
public long ContentLength { get; }
public TrackMediaResponse(Stream stream, long contentLength)
{
Stream = stream;
ContentLength = contentLength;
}
}
public class TrackMediaClient
{
private readonly HttpClient _http;
@@ -11,8 +23,14 @@ public class TrackMediaClient
_http = httpClientFactory.CreateClient("DeepDrft.Content");
}
public async Task<Stream> GetTrackMedia(string trackId)
public async Task<TrackMediaResponse> GetTrackMedia(string trackId)
{
return await _http.GetStreamAsync($"api/track/{trackId}");
var response = await _http.GetAsync($"api/track/{trackId}");
response.EnsureSuccessStatusCode();
var contentLength = response.Content.Headers.ContentLength ?? 0;
var stream = await response.Content.ReadAsStreamAsync();
return new TrackMediaResponse(stream, contentLength);
}
}