How do I release MediaPlayer after it finishes playing a sound?
Try this
voicePlayer.getMediaPlayer().setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mediaPlayer) {
mediaPlayer.stop();
if (mediaPlayer != null) {
mediaPlayer.killMediaPlayer();
}
}
});