埋点 - video播放暂停

This commit is contained in:
renhaoting 2026-01-05 13:35:58 +08:00
parent 6c858ca0d7
commit af87e4da5d
1 changed files with 14 additions and 0 deletions

View File

@ -17,6 +17,7 @@ import androidx.core.view.isVisible
import com.ama.core.architecture.appBase.AppViewsEmptyViewModelFragment
import com.ama.core.architecture.util.AndroidUtil
import com.ama.core.architecture.util.setOnClickBatch
import com.gamedog.vididin.StatisticUtil
import com.viddin.videos.free.R
import com.gamedog.vididin.beans.YoutubeVideo
import com.gamedog.vididin.widget.MyPlayerControlView
@ -179,6 +180,17 @@ class HomeItemFragment : AppViewsEmptyViewModelFragment<ViewBinding>() {
})
}
private fun sendPlayStopStatistic(isPlayStart: Boolean) {
mVideoData?.let {
StatisticUtil.reportEvents(if (isPlayStart) StatisticUtil.KEY_Video_Play_Start else StatisticUtil.KEY_Video_Play_End,
mapOf(
"video_id" to it.id,
"watch_duration" to mCurPlayedSecond.toInt(), //Second
"is_completed" to (Math.abs(mTotalDuration - mCurPlayedSecond) < 2),
))
}
}
private fun generateThumbAndSet() {
// capturePlayerView And Show as thumb
@ -215,6 +227,8 @@ class HomeItemFragment : AppViewsEmptyViewModelFragment<ViewBinding>() {
}
if (mIsPlaying) mTickerTimer.start() else mTickerTimer.pause()
sendPlayStopStatistic(mIsPlaying)
}
}