fix: 游戏详情-视频/图集tab 神策埋点补充—客户端 https://jira.shanqu.cc/browse/GHZSCY-7781
This commit is contained in:
@ -114,7 +114,6 @@ class GameDetailActivity : DownloadToolbarActivity() {
|
||||
view,
|
||||
listOf(
|
||||
R.id.menu_download_iv,
|
||||
R.id.gameBigEvent,
|
||||
R.id.cardContainer,
|
||||
R.id.iv_reserve,
|
||||
R.id.iv_concern,
|
||||
|
||||
@ -127,6 +127,8 @@ class GameDetailViewModel(
|
||||
var isSkipOnPageSelected = false // 是否触发论坛/专区Tab跳转
|
||||
|
||||
var defaultCoverEntity: CoverEntity? = null
|
||||
var coverTabSequence = 1 // 用于埋点,详情视频/图集tab 当前选中tab的序号,从1开始
|
||||
var coverTabName = "" // 用于埋点,详情视频/图集tab 详情视频/图集tab 当前选中tab的tab名称
|
||||
|
||||
var isGameInstalled = false
|
||||
private var isGameUpdatable = false
|
||||
|
||||
@ -187,15 +187,19 @@ class GameDetailFragment : LazyFragment(), IScrollable {
|
||||
coverSfv.goneIf(!shouldShowCoverFilter) {
|
||||
val defaultTabPosition =
|
||||
tabNameList.indexOfFirst { tabName -> viewModel.defaultCoverEntity?.tabName == tabName }
|
||||
viewModel.coverTabSequence = defaultTabPosition + 1
|
||||
viewModel.coverTabName = viewModel.defaultCoverEntity?.tabName ?: ""
|
||||
coverSfv.setItemList(tabNameList, if (defaultTabPosition != -1) defaultTabPosition else 0)
|
||||
coverSfv.setOnCheckedCallback { position ->
|
||||
val checkedText = tabNameList.getOrNull(position)
|
||||
val currentCoverEntity = it.getOrNull(coverPosition)
|
||||
viewModel.coverTabSequence = position + 1
|
||||
viewModel.coverTabName = checkedText ?: ""
|
||||
SensorsBridge.trackEvent("GameDetailMediaTabClick", json {
|
||||
"game_id" to gameEntity?.id
|
||||
"game_name" to gameEntity?.name
|
||||
"sequence" to position + 1
|
||||
"tab_name" to checkedText
|
||||
"sequence" to viewModel.coverTabSequence
|
||||
"tab_name" to viewModel.coverTabName
|
||||
})
|
||||
if (currentCoverEntity?.tabName == checkedText) return@setOnCheckedCallback
|
||||
|
||||
|
||||
@ -115,7 +115,6 @@ class GameDetailCoverAdapter(
|
||||
})
|
||||
.build(holder.binding.player)
|
||||
|
||||
holder.binding.player.gameName = viewModel.game?.name ?: ""
|
||||
holder.binding.player.viewModel = viewModel
|
||||
holder.binding.player.showOrHideCoverFilter = showOrHideCoverFilter
|
||||
holder.binding.player.video = topVideo
|
||||
|
||||
@ -14,6 +14,7 @@ import androidx.fragment.app.Fragment
|
||||
import com.gh.common.util.LogUtils
|
||||
import com.gh.download.cache.ExoCacheManager
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.base.GlobalActivityManager
|
||||
import com.gh.gamecenter.common.observer.MuteCallback
|
||||
import com.gh.gamecenter.common.observer.VolumeObserver
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
@ -40,7 +41,6 @@ class TopVideoView @JvmOverloads constructor(context: Context, attrs: AttributeS
|
||||
private var mMuteCallback: MuteCallback
|
||||
private var mVolumeObserver: VolumeObserver? = null
|
||||
|
||||
var gameName = ""
|
||||
var video: CoverTabEntity.Video? = null
|
||||
var viewModel: GameDetailViewModel? = null
|
||||
var uuid = UUID.randomUUID().toString()
|
||||
@ -87,11 +87,21 @@ class TopVideoView @JvmOverloads constructor(context: Context, attrs: AttributeS
|
||||
}
|
||||
|
||||
setBackFromFullScreenListener {
|
||||
// if (it.id == R.id.fullscreen) {
|
||||
// MtaHelper.onEvent("游戏详情_顶部视频", "${getMtaKeyPrefix()}-退出全屏", combinedTitleAndId)
|
||||
// } else if (it.id == R.id.back) {
|
||||
// MtaHelper.onEvent("游戏详情_顶部视频", "${getMtaKeyPrefix()}-点击返回", combinedTitleAndId)
|
||||
// }
|
||||
if (it.id == R.id.fullscreen || it.id == R.id.back) {
|
||||
SensorsBridge.trackGameDetailVideoClick(
|
||||
gameName = viewModel?.game?.name ?: "",
|
||||
gameId = viewModel?.game?.id ?: "",
|
||||
gameType = viewModel?.game?.categoryChinese ?: "",
|
||||
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
|
||||
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
|
||||
action = if (it.id == R.id.fullscreen) "退出全屏" else "点击返回",
|
||||
playType = if (mIsAutoPlay) "自动播放" else "主动播放",
|
||||
isFullScreen = mIfCurrentIsFullscreen,
|
||||
sequence = viewModel?.coverTabSequence ?: 1,
|
||||
tabName = viewModel?.coverTabName ?: "",
|
||||
playLength = (currentPositionWhenPlaying / 1000).toString()
|
||||
)
|
||||
}
|
||||
clearFullscreenLayout()
|
||||
}
|
||||
|
||||
@ -126,13 +136,22 @@ class TopVideoView @JvmOverloads constructor(context: Context, attrs: AttributeS
|
||||
fun startPlayLogic(isAutoPlay: Boolean) {
|
||||
mIsAutoPlay = isAutoPlay
|
||||
violenceUpdateMuteStatus()
|
||||
// if (isAutoPlay) {
|
||||
// MtaHelper.onEvent("游戏详情_顶部视频", "视频播放方式", "自动播放")
|
||||
// MtaHelper.onEvent("游戏详情_顶部视频", "顶部视频-自动播放", combinedTitleAndId)
|
||||
// } else {
|
||||
// MtaHelper.onEvent("游戏详情_顶部视频", "视频播放方式", "手动播放")
|
||||
// }
|
||||
|
||||
if (isAutoPlay) {
|
||||
SensorsBridge.trackGameDetailVideoClick(
|
||||
gameName = viewModel?.game?.name ?: "",
|
||||
gameId = viewModel?.game?.id ?: "",
|
||||
gameType = viewModel?.game?.categoryChinese ?: "",
|
||||
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
|
||||
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
|
||||
action = "自动播放",
|
||||
playType = if (mIsAutoPlay) "自动播放" else "主动播放",
|
||||
isFullScreen = mIfCurrentIsFullscreen,
|
||||
sequence = viewModel?.coverTabSequence ?: 1,
|
||||
tabName = viewModel?.coverTabName ?: "",
|
||||
playLength = (currentPositionWhenPlaying / 1000).toString()
|
||||
)
|
||||
|
||||
val seekTime = ScrollCalculatorHelper.getPlaySchedule(MD5Utils.getContentMD5(video?.url))
|
||||
seekOnStart = seekTime
|
||||
mTouchingProgressBar = false
|
||||
@ -289,7 +308,7 @@ class TopVideoView @JvmOverloads constructor(context: Context, attrs: AttributeS
|
||||
|
||||
override fun onStopTrackingTouch(seekBar: SeekBar?) {
|
||||
super.onStopTrackingTouch(seekBar)
|
||||
uploadVideoStreamingPlaying("拖动")
|
||||
uploadVideoStreamingPlaying("拖动进度条", seekBar)
|
||||
}
|
||||
|
||||
override fun isShowNetConfirm(): Boolean {
|
||||
@ -533,7 +552,7 @@ class TopVideoView @JvmOverloads constructor(context: Context, attrs: AttributeS
|
||||
}
|
||||
|
||||
override fun releaseVideos() {
|
||||
uploadVideoStreamingPlaying("结束播放")
|
||||
uploadVideoStreamingPlaying("播放完毕")
|
||||
CustomManager.releaseAllVideos(getKey())
|
||||
}
|
||||
|
||||
@ -556,11 +575,21 @@ class TopVideoView @JvmOverloads constructor(context: Context, attrs: AttributeS
|
||||
override fun onClick(v: View) {
|
||||
when (v.id) {
|
||||
R.id.start -> {
|
||||
// if (currentState == GSYVideoView.CURRENT_STATE_PLAYING) {
|
||||
// MtaHelper.onEvent("游戏详情_顶部视频", "${getMtaKeyPrefix()}-点击暂停", combinedTitleAndId)
|
||||
// } else {
|
||||
// MtaHelper.onEvent("游戏详情_顶部视频", "${getMtaKeyPrefix()}-点击播放", combinedTitleAndId)
|
||||
// }
|
||||
SensorsBridge.trackGameDetailVideoClick(
|
||||
gameName = viewModel?.game?.name ?: "",
|
||||
gameId = viewModel?.game?.id ?: "",
|
||||
gameType = viewModel?.game?.categoryChinese ?: "",
|
||||
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
|
||||
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
|
||||
action = if (currentState == GSYVideoView.CURRENT_STATE_PLAYING) "点击暂停" else "点击播放",
|
||||
playType = if (mIsAutoPlay) "自动播放" else "主动播放",
|
||||
isFullScreen = mIfCurrentIsFullscreen,
|
||||
sequence = viewModel?.coverTabSequence ?: 1,
|
||||
tabName = viewModel?.coverTabName ?: "",
|
||||
playLength = (currentPositionWhenPlaying / 1000).toString()
|
||||
)
|
||||
// 手动触发暂停/播放,后续行为都算主动播放
|
||||
mIsAutoPlay = false
|
||||
super.onClick(v)
|
||||
}
|
||||
|
||||
@ -568,13 +597,11 @@ class TopVideoView @JvmOverloads constructor(context: Context, attrs: AttributeS
|
||||
}
|
||||
}
|
||||
|
||||
private fun getMtaKeyPrefix() = if (mIfCurrentIsFullscreen) "顶部视频(全屏)" else "顶部视频"
|
||||
|
||||
fun getCurrentPosition(): Long {
|
||||
return mCurrentPosition
|
||||
}
|
||||
|
||||
fun uploadVideoStreamingPlaying(action: String) {
|
||||
fun uploadVideoStreamingPlaying(action: String, seekBar: SeekBar? = null) {
|
||||
if (video == null || video?.url.isNullOrEmpty()) return
|
||||
runOnIoThread(isHeavyWightTask = true) {
|
||||
val isLandscape = mOrientationUtils != null
|
||||
@ -598,6 +625,26 @@ class TopVideoView @JvmOverloads constructor(context: Context, attrs: AttributeS
|
||||
action, video?.videoId, video?.title, viewModel?.game?.id, viewModel?.game?.name,
|
||||
videoPlayModel, videoPlayStatus(), mContentLength, videoTotalTime, videoPlayTs, progress.toInt()
|
||||
)
|
||||
if (action != "开始播放" && action != "暂停播放" && action != "退出全屏") {
|
||||
val playLength = when (action) {
|
||||
"播放完毕" -> (duration / 1000).toString()
|
||||
"拖动进度条" -> ((seekBar?.progress ?: 0) * duration / 100000).toString()
|
||||
else -> (currentPositionWhenPlaying / 1000).toString()
|
||||
}
|
||||
SensorsBridge.trackGameDetailVideoClick(
|
||||
gameName = viewModel?.game?.name ?: "",
|
||||
gameId = viewModel?.game?.id ?: "",
|
||||
gameType = viewModel?.game?.categoryChinese ?: "",
|
||||
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
|
||||
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
|
||||
action = action,
|
||||
playType = if (mIsAutoPlay) "自动播放" else "主动播放",
|
||||
isFullScreen = mIfCurrentIsFullscreen,
|
||||
sequence = viewModel?.coverTabSequence ?: 1,
|
||||
tabName = viewModel?.coverTabName ?: "",
|
||||
playLength = playLength
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user