[8.2.2][fix]乘客屏修复因广告播放器多实例引起的tts播报时视频无法静音问题
This commit is contained in:
@@ -4,8 +4,10 @@ import android.content.Context
|
||||
import android.media.AudioManager
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.widget.media.video.CustomManager
|
||||
import com.mogo.och.common.module.manager.EnvManager
|
||||
import com.mogo.och.biz.media.audition.AuditionManager
|
||||
import com.mogo.och.biz.media.video.ads.AdVideoPlayer
|
||||
import com.mogo.och.common.module.biz.media.MusicDataChangeListener
|
||||
import com.mogo.och.common.module.biz.media.data.MusicData
|
||||
import com.mogo.och.common.module.biz.media.data.PlayState
|
||||
@@ -53,13 +55,19 @@ object AudioFocusManager : MusicDataChangeListener {
|
||||
}
|
||||
}
|
||||
if (isPlayingVideo) {
|
||||
GSYVideoManager.instance().curPlayerManager?.setNeedMute(true)
|
||||
CustomManager.getCustomManagersByTag(AdVideoPlayer.TAG).forEach{
|
||||
it.setNeedMute(true)
|
||||
}
|
||||
// GSYVideoManager.instance().curPlayerManager?.setNeedMute(true)
|
||||
}
|
||||
}else{
|
||||
if(isPlayingMusic){
|
||||
AuditionManager.setVolume(1f,1f)
|
||||
}
|
||||
GSYVideoManager.instance().curPlayerManager?.setNeedMute(false)
|
||||
CustomManager.getCustomManagersByTag(AdVideoPlayer.TAG).forEach{
|
||||
it.setNeedMute(false)
|
||||
}
|
||||
// GSYVideoManager.instance().curPlayerManager?.setNeedMute(false)
|
||||
}
|
||||
}
|
||||
CallerLogger.d(TAG, "setTTSFocusChange $isPlayingTTS--$isPlayingMusic---$isPlayingVideo")
|
||||
@@ -76,11 +84,17 @@ object AudioFocusManager : MusicDataChangeListener {
|
||||
AuditionManager.stop()
|
||||
}
|
||||
if (isPlayingTTS) {
|
||||
GSYVideoManager.instance().curPlayerManager?.setNeedMute(true)
|
||||
CustomManager.getCustomManagersByTag(AdVideoPlayer.TAG).forEach{
|
||||
it.setNeedMute(true)
|
||||
}
|
||||
// GSYVideoManager.instance().curPlayerManager?.setNeedMute(true)
|
||||
}
|
||||
} else {
|
||||
if (!isPlayingTTS) {
|
||||
GSYVideoManager.instance().curPlayerManager?.setNeedMute(false)
|
||||
CustomManager.getCustomManagersByTag(AdVideoPlayer.TAG).forEach{
|
||||
it.setNeedMute(false)
|
||||
}
|
||||
// GSYVideoManager.instance().curPlayerManager?.setNeedMute(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import com.shuyu.gsyvideoplayer.video.base.GSYVideoViewBridge as GSYVideoViewBri
|
||||
|
||||
class AdVideoPlayer : StandardGSYVideoPlayer {
|
||||
companion object {
|
||||
private const val TAG = "AdVideoPlayer"
|
||||
const val TAG = "AdVideoPlayer"
|
||||
}
|
||||
constructor(context: Context?) : super(context)
|
||||
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
|
||||
|
||||
@@ -120,6 +120,18 @@ class CustomManager : GSYVideoBaseManager() {
|
||||
}
|
||||
return customManager
|
||||
}
|
||||
/**
|
||||
* 获取所有指定tag对应的CustomManager
|
||||
*/
|
||||
@Synchronized
|
||||
fun getCustomManagersByTag(tag: String): List<CustomManager> {
|
||||
if (tag.isBlank()) {
|
||||
return emptyList()
|
||||
}
|
||||
return sMap.filterKeys { key ->
|
||||
key.startsWith(tag)
|
||||
}.values.toList()
|
||||
}
|
||||
|
||||
fun onPauseAll() {
|
||||
if (sMap.isNotEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user