Skip to content

Commit

Permalink
player updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmontemagno committed Feb 25, 2022
1 parent cabf95d commit d34251e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Mobile/Controls/Player.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ protected override void OnHandlerChanged()
{
base.OnHandlerChanged();

this.playerService ??= this.Handler.MauiContext.Services.GetService<PlayerService>();
if (playerService == null)
{
this.playerService = this.Handler.MauiContext.Services.GetService<PlayerService>();
InitPlayer();
}
}

private async void PlayGesture_Tapped(object sender, EventArgs e)
Expand All @@ -24,6 +28,14 @@ private async void PlayGesture_Tapped(object sender, EventArgs e)

internal void OnAppearing()
{
InitPlayer();
}

void InitPlayer()
{
if (playerService == null)
return;

this.playerService.IsPlayingChanged += PlayerService_IsPlayingChanged;
IsVisible = playerService.CurrentEpisode != null;
if (this.playerService.CurrentEpisode != null)
Expand Down

0 comments on commit d34251e

Please sign in to comment.