Refactor Audio Plaback layers for simplification and improved maintenance

This commit is contained in:
daniel-c-harvey
2025-09-13 08:26:12 -04:00
parent 9ac2c9182a
commit 0f0fd828d2
16 changed files with 545 additions and 534 deletions
@@ -0,0 +1,31 @@
using DeepDrftWeb.Client.Services;
using DeepDrftWeb.Client.Clients;
using Microsoft.AspNetCore.Components;
namespace DeepDrftWeb.Client.Controls;
public partial class AudioPlayerProvider : ComponentBase
{
[Inject] public required AudioInteropService AudioInterop { get; set; }
[Inject] public required TrackMediaClient TrackMediaClient { get; set; }
private AudioPlayerService? _audioPlayerService;
[Parameter] public RenderFragment? ChildContent { get; set; }
protected override void OnInitialized()
{
// Create the service immediately (but don't initialize yet)
_audioPlayerService = new AudioPlayerService(AudioInterop, TrackMediaClient);
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender && _audioPlayerService != null)
{
// Initialize the service after render when JavaScript is available
await _audioPlayerService.InitializeAsync();
StateHasChanged();
}
}
}