Browse Source

1.优化代码

王鹏鹏 2 years ago
parent
commit
8338c70e54

+ 5 - 1
baselib/src/main/java/com/yingyangfly/baselib/player/VoicePlayer.java

@@ -22,7 +22,7 @@ public class VoicePlayer {
         if (instance == null) {
             synchronized (VoicePlayer.class) {
                 if (instance == null) {
-                    instance = new VoicePlayer(context);
+                    instance = new VoicePlayer(context.getApplicationContext());
                 }
             }
         }
@@ -73,6 +73,10 @@ public class VoicePlayer {
         }
     }
 
+    public void release() {
+        instance = null;
+    }
+
     public void pause() {
         isPause = true;
         mediaPlayer.pause();