diff --git a/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java b/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java index 97b4e6a92..17be0998f 100644 --- a/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java @@ -954,20 +954,21 @@ public abstract class BasePlayer implements public void onFastRewind() { if (DEBUG) Log.d(TAG, "onFastRewind() called"); - final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); - final String key = context.getString(R.string.seek_duration_key); - final String value = prefs.getString(key, FAST_FORWARD_REWIND_DEFAULT_AMOUNT_MILLIS); - final int duration = Integer.parseInt(value); + final int duration = getSeekDuration(); seekBy(-duration); } public void onFastForward() { if (DEBUG) Log.d(TAG, "onFastForward() called"); + final int duration = getSeekDuration(); + seekBy(duration); + } + + private int getSeekDuration() { final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); final String key = context.getString(R.string.seek_duration_key); final String value = prefs.getString(key, FAST_FORWARD_REWIND_DEFAULT_AMOUNT_MILLIS); - final int duration = Integer.parseInt(value); - seekBy(duration); + return Integer.parseInt(value); } public void onPlayPrevious() {