From 3cc6690220e68a3b23c219a8422133bb59c182a4 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 17 Sep 2023 15:28:52 +0200 Subject: [PATCH] fix: don't resume initial video on fragment recreation --- .../com/github/libretube/ui/fragments/PlayerFragment.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt index 4ba138396..7f83c804b 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt @@ -841,6 +841,13 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { isTransitioning = true videoId = nextVideoId + + // fix: if the fragment is recreated, play the current video, and not the initial one + arguments?.run { + val playerData = parcelable(IntentData.playerData)!!.copy(videoId = videoId) + putParcelable(IntentData.playerData, playerData) + } + // start to play the next video playVideo() // close comment bottom sheet for next video