diff --git a/src/Plugin.Maui.Audio/AudioPlayer/AudioPlayer.android.cs b/src/Plugin.Maui.Audio/AudioPlayer/AudioPlayer.android.cs index 22612db..0f2fc1c 100644 --- a/src/Plugin.Maui.Audio/AudioPlayer/AudioPlayer.android.cs +++ b/src/Plugin.Maui.Audio/AudioPlayer/AudioPlayer.android.cs @@ -306,8 +306,6 @@ void SetVolume(double volume, double balance) void OnPlaybackEnded(object? sender, EventArgs e) { - PlaybackEnded?.Invoke(this, e); - isPlaying = player.IsPlaying; //this improves stability on older devices but has minor performance impact @@ -318,6 +316,8 @@ void OnPlaybackEnded(object? sender, EventArgs e) player.Stop(); player.Prepare(); } + + PlaybackEnded?.Invoke(this, e); } protected virtual void Dispose(bool disposing) @@ -330,6 +330,7 @@ protected virtual void Dispose(bool disposing) if (disposing) { player.Completion -= OnPlaybackEnded; + player.Reset(); player.Release(); player.Dispose(); DeleteFile(cachePath);