@@ -469,7 +469,8 @@ private void setupPlayerSeekOverlay() {
469
469
470
470
@ Override
471
471
public void onPrepare () {
472
- if (checkCorrectConditions ()) {
472
+ if (getPlayer ().getPlaybackState () == Player .STATE_IDLE
473
+ || getPlayer ().getPlaybackState () == Player .STATE_ENDED ) {
473
474
gestureListener .endMultiDoubleTap ();
474
475
return ;
475
476
}
@@ -503,12 +504,9 @@ public void onAnimationEnd() {
503
504
public Boolean shouldFastForward (@ NotNull final DisplayPortion portion ) {
504
505
// Null indicates an invalid area or condition e.g. the middle portion
505
506
// or video start or end was reached during double tap seeking
506
- if (checkCorrectConditions ()) {
507
- return null ;
508
- }
509
- if (portion == DisplayPortion .LEFT ) {
507
+ if (portion == DisplayPortion .LEFT && checkRewindCondition ()) {
510
508
return false ;
511
- } else if (portion == DisplayPortion .RIGHT ) {
509
+ } else if (portion == DisplayPortion .RIGHT && checkForwardCondition () ) {
512
510
return true ;
513
511
} else /* portion == DisplayPortion.MIDDLE */ {
514
512
return null ;
@@ -525,12 +523,17 @@ public void seek(final boolean forward) {
525
523
}
526
524
}
527
525
528
- private boolean checkCorrectConditions () {
529
- return getPlayer ().getCurrentPosition () == getPlayer ().getDuration ()
530
- // Add puffer of a half second, so that direct rewinding is not possible
531
- || getPlayer ().getCurrentPosition () <= 500L
532
- || getPlayer ().getPlaybackState () == Player .STATE_ENDED
533
- || getPlayer ().getPlaybackState () == Player .STATE_IDLE ;
526
+ private boolean checkRewindCondition () {
527
+ // Add puffer of a half second, so that direct rewinding is not possible
528
+ return getPlayer ().getCurrentPosition () > 500L
529
+ && getPlayer ().getPlaybackState () != Player .STATE_IDLE
530
+ && getPlayer ().getPlaybackState () != Player .STATE_ENDED ;
531
+ }
532
+
533
+ private boolean checkForwardCondition () {
534
+ return getPlayer ().getCurrentPosition () < getPlayer ().getDuration ()
535
+ && getPlayer ().getPlaybackState () != Player .STATE_IDLE
536
+ && getPlayer ().getPlaybackState () != Player .STATE_ENDED ;
534
537
}
535
538
});
536
539
gestureListener .doubleTapControls (seekOverlay );
0 commit comments