Fix crash using swiping gesture if video is not loaded yet
This commit is contained in:
parent
09189e4f85
commit
0399ac0bdb
1 changed files with 1 additions and 1 deletions
|
@ -95,7 +95,7 @@ class PlayerGestureHelper(
|
|||
return if ((abs(currentEvent.x - firstEvent.x) > 50 || swipeGestureProgressOpen) &&
|
||||
(!swipeGestureBrightnessOpen && !swipeGestureVolumeOpen)) {
|
||||
val currentPos = playerView.player?.currentPosition ?: 0
|
||||
val vidDuration = playerView.player?.duration ?: 0
|
||||
val vidDuration = (playerView.player?.duration ?: 0).coerceAtLeast(0)
|
||||
|
||||
val difference = ((currentEvent.x - firstEvent.x) * 90).toLong()
|
||||
val newPos = (currentPos + difference).coerceIn(0, vidDuration)
|
||||
|
|
Loading…
Reference in a new issue