diff --git a/RedBookPlayer/GUI/PlayerView.xaml.cs b/RedBookPlayer/GUI/PlayerView.xaml.cs index ad7af05..149225e 100644 --- a/RedBookPlayer/GUI/PlayerView.xaml.cs +++ b/RedBookPlayer/GUI/PlayerView.xaml.cs @@ -64,9 +64,6 @@ namespace RedBookPlayer.GUI /// Path to the image to load public async Task LoadImage(string path) { - // If the player is currently running, stop it - if(PlayerViewModel.Playing != true) PlayerViewModel.Playing = null; - bool result = await Dispatcher.UIThread.InvokeAsync(() => { PlayerViewModel.Init(path, App.Settings.AutoPlay, App.Settings.Volume); diff --git a/RedBookPlayer/GUI/PlayerViewModel.cs b/RedBookPlayer/GUI/PlayerViewModel.cs index 6699a18..c57f9fa 100644 --- a/RedBookPlayer/GUI/PlayerViewModel.cs +++ b/RedBookPlayer/GUI/PlayerViewModel.cs @@ -118,6 +118,10 @@ namespace RedBookPlayer.GUI /// Default volume between 0 and 100 to use when starting playback public void Init(string path, bool autoPlay, int defaultVolume) { + // Stop current playback, if necessary + if(Playing != null) Playing = null; + + // Create and attempt to initialize new Player _player = new Player(path, autoPlay, defaultVolume); if(Initialized) UpdateModel();