[8.2.4][B2乘客]优化广告播放器使用的单例Key
This commit is contained in:
@@ -55,19 +55,13 @@ object AudioFocusManager : MusicDataChangeListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isPlayingVideo) {
|
if (isPlayingVideo) {
|
||||||
CustomManager.getCustomManagersByTag(AdVideoPlayer.TAG).forEach{
|
CustomManager.getNullableCustomManager(AdVideoPlayer.TAG)?.setNeedMute(true)
|
||||||
it.setNeedMute(true)
|
|
||||||
}
|
|
||||||
// GSYVideoManager.instance().curPlayerManager?.setNeedMute(true)
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(isPlayingMusic){
|
if(isPlayingMusic){
|
||||||
AuditionManager.setVolume(1f,1f)
|
AuditionManager.setVolume(1f,1f)
|
||||||
}
|
}
|
||||||
CustomManager.getCustomManagersByTag(AdVideoPlayer.TAG).forEach{
|
CustomManager.getNullableCustomManager(AdVideoPlayer.TAG)?.setNeedMute(false)
|
||||||
it.setNeedMute(false)
|
|
||||||
}
|
|
||||||
// GSYVideoManager.instance().curPlayerManager?.setNeedMute(false)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CallerLogger.d(TAG, "setTTSFocusChange $isPlayingTTS--$isPlayingMusic---$isPlayingVideo")
|
CallerLogger.d(TAG, "setTTSFocusChange $isPlayingTTS--$isPlayingMusic---$isPlayingVideo")
|
||||||
@@ -84,17 +78,11 @@ object AudioFocusManager : MusicDataChangeListener {
|
|||||||
AuditionManager.stop()
|
AuditionManager.stop()
|
||||||
}
|
}
|
||||||
if (isPlayingTTS) {
|
if (isPlayingTTS) {
|
||||||
CustomManager.getCustomManagersByTag(AdVideoPlayer.TAG).forEach{
|
CustomManager.getNullableCustomManager(AdVideoPlayer.TAG)?.setNeedMute(true)
|
||||||
it.setNeedMute(true)
|
|
||||||
}
|
|
||||||
// GSYVideoManager.instance().curPlayerManager?.setNeedMute(true)
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!isPlayingTTS) {
|
if (!isPlayingTTS) {
|
||||||
CustomManager.getCustomManagersByTag(AdVideoPlayer.TAG).forEach{
|
CustomManager.getNullableCustomManager(AdVideoPlayer.TAG)?.setNeedMute(false)
|
||||||
it.setNeedMute(false)
|
|
||||||
}
|
|
||||||
// GSYVideoManager.instance().curPlayerManager?.setNeedMute(false)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,25 +48,14 @@ class AdVideoPlayer : StandardGSYVideoPlayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
override fun getGSYVideoManager(): GSYVideoViewBridge1 {
|
override fun getGSYVideoManager(): GSYVideoViewBridge1 {
|
||||||
CustomManager.getCustomManager(key).initContext(context.applicationContext)
|
CustomManager.getCustomManager(TAG).initContext(context.applicationContext)
|
||||||
return CustomManager.getCustomManager(key)
|
return CustomManager.getCustomManager(TAG)
|
||||||
}
|
|
||||||
|
|
||||||
override fun backFromFull(context: Context): Boolean {
|
|
||||||
return CustomManager.backFromWindowFull(context, key)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun releaseVideos() {
|
override fun releaseVideos() {
|
||||||
CustomManager.releaseAllVideos(key)
|
CustomManager.releaseAllVideos(TAG)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFullId(): Int {
|
|
||||||
return CustomManager.FULLSCREEN_ID
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getSmallId(): Int {
|
|
||||||
return CustomManager.SMALL_ID
|
|
||||||
}
|
|
||||||
override fun hideAllWidget() {
|
override fun hideAllWidget() {
|
||||||
Logger.d(MediaLoopPlayView.TAG, "AdvanceGSYVideoPlayer,hideAllWidget")
|
Logger.d(MediaLoopPlayView.TAG, "AdvanceGSYVideoPlayer,hideAllWidget")
|
||||||
}
|
}
|
||||||
@@ -184,14 +173,4 @@ class AdVideoPlayer : StandardGSYVideoPlayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val key: String
|
|
||||||
get() {
|
|
||||||
if (mPlayPosition == -22) {
|
|
||||||
Debuger.printfError(javaClass.simpleName + " used getKey() " + "******* PlayPosition never set. ********")
|
|
||||||
}
|
|
||||||
if (TextUtils.isEmpty(mPlayTag)) {
|
|
||||||
Debuger.printfError(javaClass.simpleName + " used getKey() " + "******* PlayTag never set. ********")
|
|
||||||
}
|
|
||||||
return TAG + mPlayPosition + mPlayTag
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -120,17 +120,15 @@ class CustomManager : GSYVideoBaseManager() {
|
|||||||
}
|
}
|
||||||
return customManager
|
return customManager
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* 获取所有指定tag对应的CustomManager
|
|
||||||
*/
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
fun getCustomManagersByTag(tag: String): List<CustomManager> {
|
fun getNullableCustomManager(key: String?): CustomManager? {
|
||||||
if (tag.isBlank()) {
|
if (TextUtils.isEmpty(key)) {
|
||||||
return emptyList()
|
return null
|
||||||
}
|
}
|
||||||
return sMap.filterKeys { key ->
|
val customManager: CustomManager? = sMap[key]
|
||||||
key.startsWith(tag)
|
return customManager
|
||||||
}.values.toList()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onPauseAll() {
|
fun onPauseAll() {
|
||||||
|
|||||||
Reference in New Issue
Block a user