Skip to content

Commit

Permalink
Unset MediaPlayer from MediaPlayerElement when exiting now playing
Browse files Browse the repository at this point in the history
  • Loading branch information
itsWindows11 committed Jun 28, 2023
1 parent d83b210 commit 1dc6882
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions Rise Media Player Dev/Windows/CompactNowPlayingPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
PointerCanceled="OnPointerExited"
PointerEntered="OnPointerEntered"
PointerExited="OnPointerExited"
Unloaded="OnPageUnloaded"
mc:Ignorable="d">

<Page.Resources>
Expand Down
5 changes: 5 additions & 0 deletions Rise Media Player Dev/Windows/CompactNowPlayingPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ private void OnPlayerLoaded(object sender, RoutedEventArgs e)
MainPlayer.SetMediaPlayer(MPViewModel.Player);
}

private void OnPageUnloaded(object sender, RoutedEventArgs e)
{
MainPlayer.SetMediaPlayer(null);
}

public static async Task NavigateAsync(Frame frame)
{
_ = await ApplicationView.GetForCurrentView().
Expand Down
2 changes: 2 additions & 0 deletions Rise Media Player Dev/Windows/NowPlayingPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ private void OnPageUnloaded(object sender, RoutedEventArgs e)
PlayerControlsQueueWatcher?.Dispose();

Bindings.StopTracking();

MainPlayer.SetMediaPlayer(null);
}

protected override void OnNavigatedTo(NavigationEventArgs e)
Expand Down

0 comments on commit 1dc6882

Please sign in to comment.