From 22b5adc4b86bd7a4dc74e062ab4797e7f089e602 Mon Sep 17 00:00:00 2001 From: Koen J Date: Wed, 22 Apr 2026 15:09:51 +0200 Subject: [PATCH] Fix for #2614 --- .../fragment/mainactivity/main/VideoDetailView.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailView.kt b/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailView.kt index 76435cf0..d0cc53f3 100644 --- a/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailView.kt +++ b/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailView.kt @@ -905,6 +905,7 @@ class VideoDetailView : ConstraintLayout { cleanupPlaybackTracker(); Logger.i(TAG, "Keep screen on unset onClose") fragment.activity?.window?.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + clearChapters() }; StatePlayer.instance.autoplayChanged.subscribe(this) { @@ -999,6 +1000,12 @@ class VideoDetailView : ConstraintLayout { _cast.stopAllGestures(); } + private fun clearChapters() { + _chapters = null + _player.setChapters(null) + _cast.setChapters(null) + } + fun showChaptersUI(){ video?.let { try { @@ -1330,6 +1337,7 @@ class VideoDetailView : ConstraintLayout { _lastVideoSource = null; _lastAudioSource = null; _lastSubtitleSource = null; + clearChapters() } fun setVideo(url: String, resumeSeconds: Long = 0, playWhenReady: Boolean = true) { Logger.i(TAG, "setVideo url=$url resumeSeconds=$resumeSeconds playWhenReady=$playWhenReady") @@ -1340,6 +1348,7 @@ class VideoDetailView : ConstraintLayout { _searchVideo = null; video = null; cleanupPlaybackTracker(); + clearChapters() _url = url; _videoResumePositionMilliseconds = resumeSeconds * 1000; _rating.visibility = View.GONE; @@ -1550,6 +1559,7 @@ class VideoDetailView : ConstraintLayout { } val me = this; + clearChapters() if (video is JSVideoDetails) { fragment.lifecycleScope.launch(Dispatchers.IO) { try {