view 没有回收的View 按照进度继续播放

This commit is contained in:
yangyakun
2022-06-24 14:22:18 +08:00
parent 2df50f3118
commit 5395fb9e0e
2 changed files with 17 additions and 3 deletions

View File

@@ -41,6 +41,8 @@ class ConsultVideoPlayer : StandardGSYVideoPlayer {
private var fullVideoPlayer:ConsultVideoPlayer?=null
private var currentTime = 0
constructor(context: Context?) : super(context)
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
constructor(context: Context?, fullFlag: Boolean?) : super(context, fullFlag)
@@ -109,7 +111,11 @@ class ConsultVideoPlayer : StandardGSYVideoPlayer {
//时间显示
currentTimeTextView.text = TimeTransformUtils.stringForTime(currentTime)
totalTimeTextView.text = TimeTransformUtils.stringForTime(totalTime)
if(currentTime==totalTime){
this.currentTime = -1
}else{
this.currentTime = currentTime
}
if (progress != 0) {
mProgressBar?.progress = progress
}
@@ -135,6 +141,7 @@ class ConsultVideoPlayer : StandardGSYVideoPlayer {
}else{
onVideoReset()
}
setVideoAllCallBack(null)
}
override fun onClick(v: View?) {
@@ -147,7 +154,15 @@ class ConsultVideoPlayer : StandardGSYVideoPlayer {
if(currentState==GSYVideoView.CURRENT_STATE_PAUSE){
onVideoResume(false)
}else{
startPlayLogic()
if (mProgressBar==null) {
startPlayLogic()
}else {
mProgressBar?.let {
seekOnStart = currentTime.toLong()
startPlayLogic()
}
}
}
}
else -> {}

View File

@@ -43,7 +43,6 @@ open class BaseIndicatorView constructor(
// 页面选定
fun onPageSelected(position: Int) {
System.err.println("BaseIndicatorView---onPageSelected:" + position)
if (getSlideMode() == IndicatorSlideMode.NORMAL) {
setCurrentPosition(position)
setSlideProgress(0f)