появляющийся плеер
This commit is contained in:
@@ -15,8 +15,10 @@
|
||||
@inject NavigationManager Navigation
|
||||
@inject AuthenticationStateProvider AuthProvider
|
||||
@inject IDialogService DialogService
|
||||
@inject IAudioPlayerService AudioPlayerService
|
||||
@implements IDisposable
|
||||
|
||||
<MudContainer MaxWidth="MaxWidth.ExtraLarge" Class="py-1" Style="height: 100%;">
|
||||
<MudContainer MaxWidth="MaxWidth.ExtraLarge" Class="py-1 px-1" Style="height: 100%;">
|
||||
<MudStack Style="height: 100%;" StretchItems="StretchItems.Start" Spacing="0">
|
||||
@*Первый элемент растянется на всю высоту*@
|
||||
<MudItem Style="min-height: 0; height: 100%;">
|
||||
@@ -128,9 +130,9 @@
|
||||
</MudItem>
|
||||
|
||||
@*Второй элемент - плеер. Привязан к нижней части контейнера*@
|
||||
<MudItem>
|
||||
<MudCollapse Expanded="@(AudioPlayerService.CurrentTrackId != null)" >
|
||||
<AudioPlayer />
|
||||
</MudItem>
|
||||
</MudCollapse>
|
||||
</MudStack>
|
||||
</MudContainer>
|
||||
|
||||
@@ -411,6 +413,13 @@
|
||||
_currentUserId = authState.User.FindFirst(System.Security.Claims.ClaimTypes.NameIdentifier)?.Value;
|
||||
await LoadPlaylist();
|
||||
await LoadTracks();
|
||||
AudioPlayerService.OnStartedTrack += OnPlayerStateChanged;
|
||||
AudioPlayerService.OnEndedTrack += OnPlayerStateChanged;
|
||||
}
|
||||
|
||||
private void OnPlayerStateChanged()
|
||||
{
|
||||
InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
/// <summary>Установка разрешений.</summary>
|
||||
@@ -793,4 +802,10 @@
|
||||
var result = await dialog.Result;
|
||||
}
|
||||
#endregion
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
AudioPlayerService.OnStartedTrack -= OnPlayerStateChanged;
|
||||
AudioPlayerService.OnEndedTrack -= OnPlayerStateChanged;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user