소스 검색

1.修改离开当前页面语音还在播放bug

王鹏鹏 2 년 전
부모
커밋
aa30eb19e1
1개의 변경된 파일5개의 추가작업 그리고 3개의 파일을 삭제
  1. 5 3
      game/src/main/java/com/yingyangfly/game/play/PlayGameActivity.kt

+ 5 - 3
game/src/main/java/com/yingyangfly/game/play/PlayGameActivity.kt

@@ -396,9 +396,11 @@ class PlayGameActivity : BaseMVVMActivity<ActivityPlayGameBinding, PlayGameViewM
                 val voicePlayerBean = voicePlayerDao.getVoicePlayerBean(desn)
                 if (voicePlayerBean != null) {
                     if (voicePlayer != null) {
-                        voicePlayer?.play(voicePlayerBean.url) {
-                            binding.tvIntroduce.text = gameShortDesn
-                            callPlayBgMusic()
+                        if (isTopActivity(this)) {
+                            voicePlayer?.play(voicePlayerBean.url) {
+                                binding.tvIntroduce.text = gameShortDesn
+                                callPlayBgMusic()
+                            }
                         }
                     }
                 } else {