瀏覽代碼

Fix: remove audio from media player when audio end to stop cycle

Shan-PC\Shan 6 年之前
父節點
當前提交
6f298dde84
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/main/java/com/bomostory/sceneeditmodule/utils/MusicPlayer.kt

+ 3 - 0
src/main/java/com/bomostory/sceneeditmodule/utils/MusicPlayer.kt

@@ -38,6 +38,9 @@ class MusicPlayer {
                 setOnPreparedListener {
                     it.start()
                 }
+                setOnCompletionListener {
+                    mediaPlayers.remove(it)
+                }
             }
             mediaPlayers.add(mediaPlayer)
         }