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:
@@ -1,5 +1,6 @@
|
||||
using DeepDrftModels.Entities;
|
||||
using DeepDrftModels.Models;
|
||||
using DeepDrftWeb.Client.Services;
|
||||
using DeepDrftWeb.Client.ViewModels;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
@@ -7,13 +8,17 @@ namespace DeepDrftWeb.Client.Pages;
|
||||
|
||||
public partial class TracksView : ComponentBase
|
||||
{
|
||||
[Inject]
|
||||
public required TracksViewModel ViewModel { get; set; }
|
||||
|
||||
[Inject] public required TracksViewModel ViewModel { get; set; }
|
||||
[Inject] public required AudioPlaybackEngine AudioPlaybackEngine { get; set; }
|
||||
|
||||
private TrackEntity? _selectedTrack = null;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await SetPage(1);
|
||||
|
||||
if (!RendererInfo.IsInteractive) return;
|
||||
await AudioPlaybackEngine.InitializeAudioPlayer();
|
||||
}
|
||||
|
||||
private async Task SetPage(int newPage)
|
||||
@@ -26,4 +31,12 @@ public partial class TracksView : ComponentBase
|
||||
ViewModel.PageSize = pageResult.PageSize;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task PlayTrack(TrackEntity? track)
|
||||
{
|
||||
if (track == null) return;
|
||||
|
||||
await AudioPlaybackEngine.LoadTrack(track);
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user