[M2]视频播放切换线程
This commit is contained in:
@@ -61,8 +61,8 @@ class AdvanceGSYVideoPlayer: StandardGSYVideoPlayer {
|
||||
setViewShowState(mBackButton, INVISIBLE)
|
||||
setViewShowState(mStartButton, INVISIBLE)
|
||||
|
||||
setViewShowState(mThumbImageViewLayout, INVISIBLE)
|
||||
setViewShowState(mThumbImageView, INVISIBLE)
|
||||
// setViewShowState(mThumbImageViewLayout, INVISIBLE)
|
||||
// setViewShowState(mThumbImageView, INVISIBLE)
|
||||
|
||||
setViewShowState(mTopContainer, INVISIBLE)
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class AdvanceVideoView @JvmOverloads constructor(
|
||||
private fun initCacheImgView() {
|
||||
cacheImage = ImageView(context)
|
||||
cacheImage?.scaleType = ImageView.ScaleType.FIT_XY
|
||||
addView(cacheImage, LayoutParams(-1, -1))
|
||||
// addView(cacheImage, LayoutParams(-1, -1))
|
||||
}
|
||||
|
||||
private fun initVideoView() {
|
||||
@@ -102,7 +102,7 @@ class AdvanceVideoView @JvmOverloads constructor(
|
||||
// )
|
||||
// .into(it)
|
||||
// }
|
||||
// videoViewPlayer?.thumbImageView = cacheImage
|
||||
videoViewPlayer?.thumbImageView = cacheImage
|
||||
setCacheImageViewVisible()
|
||||
// }
|
||||
// }
|
||||
@@ -117,20 +117,18 @@ class AdvanceVideoView @JvmOverloads constructor(
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
fun setCacheImageViewVisible() {
|
||||
Logger.d(ImageAndVideoRotation.TAG, "setCacheImageViewVisible")
|
||||
// videoViewPlayer?.setCacheImageViewVisible()
|
||||
UiThreadHandler.post {
|
||||
cacheImage?.visibility = VISIBLE
|
||||
// cacheImage?.visibility = VISIBLE
|
||||
videoViewPlayer?.setCacheImageViewVisible()
|
||||
}
|
||||
}
|
||||
|
||||
fun setCacheImageViewGone() {
|
||||
Logger.d(ImageAndVideoRotation.TAG, "setCacheImageViewGone")
|
||||
UiThreadHandler.post {
|
||||
cacheImage?.visibility = GONE
|
||||
// cacheImage?.visibility = GONE
|
||||
videoViewPlayer?.setCacheImageViewGone()
|
||||
}
|
||||
// videoViewPlayer?.setCacheImageViewGone()
|
||||
// videoViewPlayer?.clearThumbImageView()
|
||||
|
||||
}
|
||||
|
||||
fun setVideo(onCompletionListener: GSYSampleCallBack) {
|
||||
@@ -215,7 +213,6 @@ class AdvanceVideoView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
override fun onFinished(url: String?, threadBean: ThreadBean?) {
|
||||
setCacheImageViewGone()
|
||||
Logger.d(ImageAndVideoRotation.TAG, "download-onFinished = $url")
|
||||
if (url.equals(fileNetPath)){ //发现下载工具在断网又连网后,已完成的任务又都下载,跳转播放出现问题
|
||||
//下载完成
|
||||
@@ -227,7 +224,9 @@ class AdvanceVideoView @JvmOverloads constructor(
|
||||
",currentUrl = $fileNetPath ")
|
||||
if (FileUtils.isFileExists(mVideoDirPath+downloadVideoName)){
|
||||
Logger.d(ImageAndVideoRotation.TAG, "have download startPlay")
|
||||
startPlay()
|
||||
ThreadUtils.runOnUiThread {
|
||||
startPlay()
|
||||
}
|
||||
return
|
||||
}else{
|
||||
startDownLoadVideo()
|
||||
|
||||
@@ -118,11 +118,15 @@ class AdvanceVideoView @JvmOverloads constructor(
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
fun setCacheImageViewVisible() {
|
||||
videoViewPlayer?.setCacheImageViewVisible()
|
||||
UiThreadHandler.post {
|
||||
videoViewPlayer?.setCacheImageViewVisible()
|
||||
}
|
||||
}
|
||||
|
||||
fun setCacheImageViewGone() {
|
||||
videoViewPlayer?.setCacheImageViewGone()
|
||||
UiThreadHandler.post {
|
||||
videoViewPlayer?.setCacheImageViewGone()
|
||||
}
|
||||
}
|
||||
|
||||
fun setVideo(onCompletionListener: GSYSampleCallBack) {
|
||||
@@ -193,6 +197,7 @@ class AdvanceVideoView @JvmOverloads constructor(
|
||||
|
||||
private val downListener = object : IDownload {
|
||||
override fun onStart(url: String?) {
|
||||
setCacheImageViewVisible()
|
||||
Logger.d(ImageVideoRotationView.TAG, "download-onStart")
|
||||
}
|
||||
|
||||
@@ -222,7 +227,9 @@ class AdvanceVideoView @JvmOverloads constructor(
|
||||
)
|
||||
if (FileUtils.isFileExists(mVideoDirPath + downloadVideoName)) {
|
||||
Logger.d(ImageVideoRotationView.TAG, "have download startPlay")
|
||||
startPlay()
|
||||
ThreadUtils.runOnUiThread {
|
||||
startPlay()
|
||||
}
|
||||
return
|
||||
} else {
|
||||
startDownLoadVideo()
|
||||
|
||||
Reference in New Issue
Block a user