Closed Marchuck closed 7 years ago
I've added comments about that, but the root cause is still unknown :(
ok, after some debugging I found that there is some bugs in the code. Running mediaPlayer throws IllegalStateException
I think clearner way is simple check
if ( mediaPlayer.isPlaying() ) { mediaPlayer.stop(); }
when disposing MediaPlayer
sometimes I got IllegalStateException
during mediaPlayer.reset()
execution.
This leads to skipping the mediaPlayer.release()
which leads to leak.
I made some snippet for my use case
https://gist.github.com/Marchuck/743785962b98db1522ed4ab338d664c0
hope it helps somebody
Cool, could you please submit a PR?
just curious about the 50ms delay before releasing the
MediaPlayer
did you discovered something regarding this topic?https://github.com/Piasy/RxAndroidAudio/blob/master/rxandroidaudio/src/main/java/com/github/piasy/rxandroidaudio/RxAudioPlayer.java#L231