Files
SecurityDefenseDevice/app/src/main/java/com/example/defenseapplication/view/MyGSYVideoPlayerLive.kt
2026-06-10 11:20:35 +08:00

85 lines
2.3 KiB
Kotlin

package com.example.defenseapplication.view
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import com.example.defenseapplication.R
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
import com.shuyu.gsyvideoplayer.video.base.GSYBaseVideoPlayer
class MyGSYVideoPlayerLive @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null
) : StandardGSYVideoPlayer(context, attrs) {
override fun init(context: Context) {
super.init(context)
startButton.visibility = View.GONE
}
override fun updateStartImage() {
startButton.visibility = View.GONE
}
override fun startWindowFullscreen(
context: Context?,
actionBar: Boolean,
statusBar: Boolean
): GSYBaseVideoPlayer {
val player = super.startWindowFullscreen(
context,
actionBar,
statusBar
) as MyGSYVideoPlayerLive
// 隐藏GSY自带UI
player.backButton.visibility = View.GONE
player.titleTextView.visibility = View.GONE
player.startButton.visibility = View.GONE
player.fullscreenButton.visibility = View.GONE
player.findViewById<View>(
com.shuyu.gsyvideoplayer.R.id.current
)?.visibility = View.GONE
player.findViewById<View>(
com.shuyu.gsyvideoplayer.R.id.total
)?.visibility = View.GONE
player.findViewById<View>(
com.shuyu.gsyvideoplayer.R.id.progress
)?.visibility = View.GONE
player.findViewById<View>(
com.shuyu.gsyvideoplayer.R.id.layout_bottom
)?.visibility = View.GONE
player.findViewById<View>(
com.shuyu.gsyvideoplayer.R.id.layout_top
)?.visibility = View.GONE
// 加载你的全屏覆盖层
val overlay = LayoutInflater.from(context)
.inflate(
R.layout.layout_my_player,
player,
false
)
player.addView(overlay)
// 找按钮
overlay.findViewById<View>(R.id.btnAi)
?.setOnClickListener {
}
overlay.findViewById<View>(R.id.btnCapture)
?.setOnClickListener {
}
return player
}
}