Files
deepdrft/DeepDrftWeb.Client/Controls/TrackPlayer.razor.cs
T
daniel-c-harvey 7f78545a02 *Audio Playback*
Content API:
 - Enabling CORS for access from Blazor app
Web Server:
 - Content API URL environment config
 - Web Audio API JS Interop layer in TypeScript
 - HttpClient configs
Web Client:
 - Audio Tack player controls
 - Audio Player example page
 - Audio Interop Service Layer
 - Named HttpClients
2025-09-05 10:48:07 -04:00

29 lines
834 B
C#

using Microsoft.AspNetCore.Components;
using DeepDrftModels.Entities;
using DeepDrftWeb.Client.Clients;
using MudBlazor;
namespace DeepDrftWeb.Client.Controls;
public partial class TrackPlayer : ComponentBase
{
[Parameter] public required TrackEntity Track { get; set; }
[Inject] public required TrackMediaClient Client { get; set; }
private Stream? _audioStream = null;
private bool _isPlaying = false;
private string _playPauseIcon => _isPlaying ? Icons.Material.Filled.Pause : Icons.Material.Filled.PlayArrow;
private async Task HandlePlayClick()
{
if (_audioStream == null)
{
_audioStream = await Client.GetTrackMedia(Track.EntryKey);
PlayAudio();
}
}
private void PlayAudio()
{
throw new NotImplementedException();
}
}