|
@@ -16,7 +16,6 @@ public class VoicePlayer {
|
|
|
private AudioManager audioManager;
|
|
|
private MediaPlayer mediaPlayer;
|
|
|
private boolean isPause;
|
|
|
- private boolean isLoading;
|
|
|
private MediaPlayer.OnCompletionListener onCompletionListener;
|
|
|
|
|
|
public static VoicePlayer getInstance(Context context) {
|
|
@@ -55,9 +54,7 @@ public class VoicePlayer {
|
|
|
if (!TextUtils.isEmpty(url)) {
|
|
|
mediaPlayer.setDataSource(url);
|
|
|
mediaPlayer.prepareAsync();
|
|
|
- isLoading = true;
|
|
|
mediaPlayer.setOnPreparedListener(mp -> {
|
|
|
- isLoading = false;
|
|
|
mediaPlayer.start();
|
|
|
});
|
|
|
mediaPlayer.setOnCompletionListener(mp -> {
|
|
@@ -72,7 +69,6 @@ public class VoicePlayer {
|
|
|
|
|
|
public void stop() {
|
|
|
isPause = false;
|
|
|
- isLoading = false;
|
|
|
mediaPlayer.stop();
|
|
|
mediaPlayer.reset();
|
|
|
if (onCompletionListener != null) {
|