1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-24 09:00:31 +00:00

Adjust BasePlayer to use seek duration of preferences.

Changes behaviour when double-tapping in video and clicking fast forward/rewind in background mode.
This commit is contained in:
Xiang Rong Lin 2019-10-21 15:44:35 +02:00
parent 550364906d
commit dcd35b038e

View File

@ -178,7 +178,7 @@ public abstract class BasePlayer implements
// Player // Player
//////////////////////////////////////////////////////////////////////////*/ //////////////////////////////////////////////////////////////////////////*/
protected final static int FAST_FORWARD_REWIND_AMOUNT_MILLIS = 10000; // 10 Seconds protected final static String FAST_FORWARD_REWIND_DEFAULT_AMOUNT_MILLIS = "10000"; // 10 seconds
protected final static int PLAY_PREV_ACTIVATION_LIMIT_MILLIS = 5000; // 5 seconds protected final static int PLAY_PREV_ACTIVATION_LIMIT_MILLIS = 5000; // 5 seconds
protected final static int PROGRESS_LOOP_INTERVAL_MILLIS = 500; protected final static int PROGRESS_LOOP_INTERVAL_MILLIS = 500;
protected final static int RECOVERY_SKIP_THRESHOLD_MILLIS = 3000; // 3 seconds protected final static int RECOVERY_SKIP_THRESHOLD_MILLIS = 3000; // 3 seconds
@ -954,12 +954,20 @@ public abstract class BasePlayer implements
public void onFastRewind() { public void onFastRewind() {
if (DEBUG) Log.d(TAG, "onFastRewind() called"); if (DEBUG) Log.d(TAG, "onFastRewind() called");
seekBy(-FAST_FORWARD_REWIND_AMOUNT_MILLIS); 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);
} }
public void onFastForward() { public void onFastForward() {
if (DEBUG) Log.d(TAG, "onFastForward() called"); if (DEBUG) Log.d(TAG, "onFastForward() called");
seekBy(FAST_FORWARD_REWIND_AMOUNT_MILLIS); 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);
} }
public void onPlayPrevious() { public void onPlayPrevious() {