diff --git a/app/src/main/java/com/gh/download/cache/CacheManager.java b/app/src/main/java/com/gh/download/cache/CacheManager.java
index 7154b8d0a2..b71b3eec00 100644
--- a/app/src/main/java/com/gh/download/cache/CacheManager.java
+++ b/app/src/main/java/com/gh/download/cache/CacheManager.java
@@ -165,7 +165,7 @@ public class CacheManager {
}
fileOutputStream.flush();
getDownCalls().remove(url);
- } catch (IOException ex) {
+ } catch (Exception ex) {
ex.printStackTrace();
} finally {
if (is != null) {
@@ -202,7 +202,7 @@ public class CacheManager {
response.close();
return contentLength == 0 ? CacheInfo.TOTAL_ERROR : contentLength;
}
- } catch (IOException e) {
+ } catch (Exception e) {
e.printStackTrace();
}
return CacheInfo.TOTAL_ERROR;
diff --git a/app/src/main/java/com/gh/gamecenter/video/detail/VideoDetailContainerFragment.kt b/app/src/main/java/com/gh/gamecenter/video/detail/VideoDetailContainerFragment.kt
index 62c23aaa7a..d45d063559 100644
--- a/app/src/main/java/com/gh/gamecenter/video/detail/VideoDetailContainerFragment.kt
+++ b/app/src/main/java/com/gh/gamecenter/video/detail/VideoDetailContainerFragment.kt
@@ -38,6 +38,7 @@ import com.lightgame.download.DownloadEntity
import com.lightgame.listeners.OnBackPressedListener
import com.scwang.smartrefresh.layout.footer.ClassicsFooter
import com.shuyu.gsyvideoplayer.video.base.GSYVideoView.CURRENT_STATE_PAUSE
+import com.shuyu.gsyvideoplayer.video.base.GSYVideoView.CURRENT_STATE_PLAYING
import io.reactivex.disposables.Disposable
import kotlinx.android.synthetic.main.fragment_video_detail_container.*
import kotlinx.android.synthetic.main.reuse_no_connection.*
@@ -240,6 +241,7 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
if (mScheduledPlayDisposable != null && !mScheduledPlayDisposable!!.isDisposed) {
mScheduledPlayDisposable!!.dispose()
+ mScheduledPlayDisposable = null
}
val isShowClick = SPUtils.getBoolean(Constants.SP_SHOW_CLICK_GUIDE)
@@ -259,13 +261,14 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
mScheduledPlayDisposable = rxTimer(1) {
if (it >= 500) {
mScheduledPlayDisposable?.dispose()
+ mScheduledPlayDisposable = null
if (pos + 2 <= mAdapter.videoList.size - 1) {//预加载视频
CacheManager.getInstance().download(mAdapter.videoList[pos + 1].url, object : CacheObserver() {})
CacheManager.getInstance().download(mAdapter.videoList[pos + 2].url, object : CacheObserver() {})
} else if (pos + 1 <= mAdapter.videoList.size - 1) {
CacheManager.getInstance().download(mAdapter.videoList[pos + 1].url, object : CacheObserver() {})
}
- if (mLastPosition != pos && videoView?.isInPlayingState != true) {
+ if (mLastPosition != pos /*&& videoView?.isInPlayingState != true*/) {
CacheManager.getInstance().cancel(mAdapter.videoList[pos].url)
CustomManager.releaseAllVideos("detail_${mViewModel.uuid}")
videoView?.startPlayLogic()
@@ -438,7 +441,7 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
val videoView = findFirstCompletelyVisibleVideoViewByPosition()
videoView?.run {
if (currentState == CURRENT_STATE_PAUSE) {
- CustomManager.onResume("detail_${mViewModel.uuid}", false)
+// CustomManager.onResume("detail_${mViewModel.uuid}", false)
videoView.onVideoResume(false)
} else {//快速切换视频后再切换页面可能没有播放
videoView.startPlayLogic()
@@ -461,19 +464,19 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
mScheduledPlayDisposable!!.dispose()
mScheduledPlayDisposable = null
}
-
DownloadManager.getInstance(requireContext()).removeObserver(dataWatcher)
- findFirstCompletelyVisibleVideoViewByPosition()?.uploadVideoStreamingPlaying("暂停页面")
- if (pauseVideo[mViewModel.uuid] == true) {
- CustomManager.onPause("detail_${mViewModel.uuid}")
- findFirstCompletelyVisibleVideoViewByPosition()?.onVideoPause()
- }
- mBaseHandler.postDelayed({
+ val videoView = findFirstCompletelyVisibleVideoViewByPosition()
+ videoView?.run {
+ videoView.uploadVideoStreamingPlaying("暂停页面")
if (pauseVideo[mViewModel.uuid] == true) {
- CustomManager.onPause("detail_${mViewModel.uuid}")
- findFirstCompletelyVisibleVideoViewByPosition()?.onVideoPause()
+ if (videoView.currentState == CURRENT_STATE_PLAYING) {
+// CustomManager.onPause("detail_${mViewModel.uuid}")
+ videoView.onVideoPause()
+ } else {
+ CustomManager.releaseAllVideos("detail_${mViewModel.uuid}")
+ }
}
- }, 500)
+ } ?: CustomManager.releaseAllVideos("detail_${mViewModel.uuid}")
if (slideGuideAnimation.isAnimating) {
slideGuideAnimation.cancelAnimation()
guideRl.visibility = View.GONE
diff --git a/app/src/main/res/drawable/bg_video_detail_top.xml b/app/src/main/res/drawable/bg_video_detail_top.xml
new file mode 100644
index 0000000000..f1913be85c
--- /dev/null
+++ b/app/src/main/res/drawable/bg_video_detail_top.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/layout_video_detail_surface.xml b/app/src/main/res/layout/layout_video_detail_surface.xml
index 90c24b27f7..9e5f733935 100644
--- a/app/src/main/res/layout/layout_video_detail_surface.xml
+++ b/app/src/main/res/layout/layout_video_detail_surface.xml
@@ -45,6 +45,11 @@
+
+