mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-15 06:40:30 +05:30
Fix issues with the seekbar
This commit is contained in:
parent
4a5bed6f99
commit
bc54390f31
@ -97,18 +97,22 @@ class AudioPlayerFragment : BaseFragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImageHelper.loadImage(current.thumbnail, binding.thumbnail)
|
ImageHelper.loadImage(current.thumbnail, binding.thumbnail)
|
||||||
|
|
||||||
|
initializeSeekBar()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initializeSeekBar() {
|
private fun initializeSeekBar() {
|
||||||
binding.timeBar.valueTo = playerService.getDuration()?.toFloat() ?: return
|
if (!this::playerService.isInitialized) return
|
||||||
|
|
||||||
|
binding.timeBar.valueTo = (playerService.getDuration()?.toFloat() ?: return) / 1000
|
||||||
binding.timeBar.addOnChangeListener { _, value, fromUser ->
|
binding.timeBar.addOnChangeListener { _, value, fromUser ->
|
||||||
if (fromUser) playerService.seekToPosition(value.toLong())
|
if (fromUser) playerService.seekToPosition(value.toLong() * 1000)
|
||||||
}
|
}
|
||||||
updateCurrentPosition()
|
updateCurrentPosition()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateCurrentPosition() {
|
private fun updateCurrentPosition() {
|
||||||
binding.timeBar.value = playerService.getCurrentPosition()?.toFloat() ?: 0f
|
binding.timeBar.value = (playerService.getCurrentPosition()?.toFloat() ?: 0f) / 1000
|
||||||
handler.postDelayed(this::updateCurrentPosition, 200)
|
handler.postDelayed(this::updateCurrentPosition, 200)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user