diff --git a/packages/audioplayers_android/android/src/main/kotlin/xyz/luan/audioplayers/player/WrappedPlayer.kt b/packages/audioplayers_android/android/src/main/kotlin/xyz/luan/audioplayers/player/WrappedPlayer.kt index 9018e2d79..853574e29 100644 --- a/packages/audioplayers_android/android/src/main/kotlin/xyz/luan/audioplayers/player/WrappedPlayer.kt +++ b/packages/audioplayers_android/android/src/main/kotlin/xyz/luan/audioplayers/player/WrappedPlayer.kt @@ -266,6 +266,9 @@ class WrappedPlayer internal constructor( } fun onError(what: Int, extra: Int): Boolean { + // When an error occurs, reset player to not [prepared]. + // Then no functions will be called, which end up in an illegal player state. + prepared = false val whatMsg = if (what == MediaPlayer.MEDIA_ERROR_SERVER_DIED) { "MEDIA_ERROR_SERVER_DIED" } else {