From 72a39c32f92a2c502c86622b9026ab4d6a0ab935 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 8 Sep 2026 16:48:17 +0200 Subject: [PATCH] feat: make subtitle delay positive for subtitles shown too late Invert the sign convention of the player subtitle delay so the value in the offset dialog is the number of milliseconds the subtitles are shown too late (a lag), and a negative value means they are shown too early. - subtitleDelay no longer negates setSubtitleOffset/getSubtitleOffset, so the box value matches the decoder offset sign. The +/> and -/< buttons are unchanged, so each press now shifts playback the opposite way. - Swap the two hint format strings so the wording tracks the new sign (positive -> too late, negative -> too early). - Flip the sync-list position math and the row-tap handler to match the new offset sign. Generated with AI --- .../cloudstream3/ui/player/FullScreenPlayer.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/player/FullScreenPlayer.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/player/FullScreenPlayer.kt index d90b6043f28..f38a9ab99fd 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/player/FullScreenPlayer.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/player/FullScreenPlayer.kt @@ -102,12 +102,12 @@ open class FullScreenPlayer : AbstractPlayerFragment( private var hideControlsNames = false protected var subtitleDelay set(value) = try { - player.setSubtitleOffset(-value) + player.setSubtitleOffset(value) } catch (e: Exception) { logError(e) } get() = try { - -player.getSubtitleOffset() + player.getSubtitleOffset() } catch (e: Exception) { logError(e) 0L @@ -527,7 +527,7 @@ open class FullScreenPlayer : AbstractPlayerFragment( // Scroll to the first active subtitle val playerPosition = player.getPosition() ?: 0 - val totalPosition = playerPosition - currentOffset + val totalPosition = playerPosition + currentOffset subtitleAdapter?.updateTime(totalPosition) subtitleAdapter?.getLatestActiveItem(totalPosition) @@ -537,11 +537,11 @@ open class FullScreenPlayer : AbstractPlayerFragment( val str = when { time > 0L -> { - txt(R.string.subtitle_offset_extra_hint_later_format, time) + txt(R.string.subtitle_offset_extra_hint_before_format, time) } time < 0L -> { - txt(R.string.subtitle_offset_extra_hint_before_format, -time) + txt(R.string.subtitle_offset_extra_hint_later_format, -time) } else -> { @@ -559,12 +559,12 @@ open class FullScreenPlayer : AbstractPlayerFragment( subtitleOffsetRecyclerview.isVisible = subtitles.isNotEmpty() noSubtitlesLoadedNotice.isVisible = subtitles.isEmpty() - val initialSubtitlePosition = (player.getPosition() ?: 0) - currentOffset + val initialSubtitlePosition = (player.getPosition() ?: 0) + currentOffset subtitleAdapter = SubtitleOffsetItemAdapter(initialSubtitlePosition) { subtitleCue -> val playerPosition = player.getPosition() ?: 0 subtitleOffsetInput.text = Editable.Factory.getInstance() - ?.newEditable((playerPosition - subtitleCue.startTimeMs).toString()) + ?.newEditable((subtitleCue.startTimeMs - playerPosition).toString()) }.apply { submitList(subtitles) }