mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
Fixed skip button not disappearing (#4072)
Co-authored-by: general-a <404aaronm@gmail.com>
This commit is contained in:
parent
deef9a0c49
commit
ad4d477834
@ -459,6 +459,17 @@ object PlayerHelper {
|
||||
return null
|
||||
}
|
||||
|
||||
fun ExoPlayer.isInSegment(
|
||||
segments: List<Segment>
|
||||
): Boolean {
|
||||
for (segment in segments) {
|
||||
val segmentStart = (segment.segment[0] * 1000f).toLong()
|
||||
val segmentEnd = (segment.segment[1] * 1000f).toLong()
|
||||
if (currentPosition in segmentStart..segmentEnd) { return true }
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a dialog with the chapters provided, even if the list is empty
|
||||
*/
|
||||
|
@ -81,6 +81,7 @@ import com.github.libretube.helpers.LocaleHelper
|
||||
import com.github.libretube.helpers.NavigationHelper
|
||||
import com.github.libretube.helpers.PlayerHelper
|
||||
import com.github.libretube.helpers.PlayerHelper.checkForSegments
|
||||
import com.github.libretube.helpers.PlayerHelper.isInSegment
|
||||
import com.github.libretube.helpers.PlayerHelper.loadPlaybackParams
|
||||
import com.github.libretube.helpers.PreferenceHelper
|
||||
import com.github.libretube.helpers.ProxyHelper
|
||||
@ -668,10 +669,10 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
||||
binding.sbSkipBtn.visibility = View.VISIBLE
|
||||
binding.sbSkipBtn.setOnClickListener {
|
||||
exoPlayer.seekTo(segmentEnd)
|
||||
binding.sbSkipBtn.visibility = View.GONE
|
||||
}
|
||||
return
|
||||
}
|
||||
if (!exoPlayer.isInSegment(segments)) binding.sbSkipBtn.visibility = View.GONE
|
||||
}
|
||||
|
||||
private fun playVideo() {
|
||||
|
Loading…
Reference in New Issue
Block a user