*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
This commit is contained in:
@@ -1,14 +1,29 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using DeepDrftModels.Entities;
|
||||
using DeepDrftWeb.Client.Clients;
|
||||
using MudBlazor;
|
||||
|
||||
namespace DeepDrftWeb.Client.Controls;
|
||||
|
||||
public partial class TrackPlayer : ComponentBase
|
||||
{
|
||||
[Parameter] public TrackEntity? Track { get; set; }
|
||||
|
||||
private void HandlePlayClick()
|
||||
[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()
|
||||
{
|
||||
// TODO: Implement play functionality with injected service
|
||||
if (_audioStream == null)
|
||||
{
|
||||
_audioStream = await Client.GetTrackMedia(Track.EntryKey);
|
||||
PlayAudio();
|
||||
}
|
||||
}
|
||||
|
||||
private void PlayAudio()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user