mirror of
https://github.com/recloudstream/cloudstream.git
synced 2026-07-13 00:13:17 +00:00
Compare commits
1 commit
master
...
fixsubtitl
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ccbd574d6 |
1 changed files with 14 additions and 1 deletions
|
|
@ -531,9 +531,22 @@ open class FullScreenPlayer : AbstractPlayerFragment<FragmentPlayerBinding>(
|
|||
|
||||
var currentOffset = subtitleDelay
|
||||
binding.apply {
|
||||
var subtitleAdapter: SubtitleOffsetItemAdapter? = null
|
||||
|
||||
subtitleOffsetInput.doOnTextChanged { text, _, _, _ ->
|
||||
text?.toString()?.toLongOrNull()?.let { time ->
|
||||
currentOffset = time
|
||||
|
||||
// Scroll to the first active subtitle
|
||||
val playerPosition = player.getPosition() ?: 0
|
||||
val totalPosition = playerPosition - currentOffset
|
||||
subtitleAdapter?.updateTime(totalPosition)
|
||||
|
||||
subtitleAdapter?.getLatestActiveItem(totalPosition)
|
||||
?.let { subtitlePos ->
|
||||
subtitleOffsetRecyclerview.scrollToPosition(subtitlePos)
|
||||
}
|
||||
|
||||
val str = when {
|
||||
time > 0L -> {
|
||||
txt(R.string.subtitle_offset_extra_hint_later_format, time)
|
||||
|
|
@ -559,7 +572,7 @@ open class FullScreenPlayer : AbstractPlayerFragment<FragmentPlayerBinding>(
|
|||
noSubtitlesLoadedNotice.isVisible = subtitles.isEmpty()
|
||||
|
||||
val initialSubtitlePosition = (player.getPosition() ?: 0) - currentOffset
|
||||
val subtitleAdapter =
|
||||
subtitleAdapter =
|
||||
SubtitleOffsetItemAdapter(initialSubtitlePosition) { subtitleCue ->
|
||||
val playerPosition = player.getPosition() ?: 0
|
||||
subtitleOffsetInput.text = Editable.Factory.getInstance()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue