全屏视频自定义
This commit is contained in:
@@ -2,8 +2,11 @@ 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
|
||||
@@ -17,4 +20,66 @@ class MyGSYVideoPlayerLive @JvmOverloads constructor(
|
||||
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
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user