diff --git a/app/src/main/java/net/schueller/peertube/fragment/VideoMenuSpeedFragment.java b/app/src/main/java/net/schueller/peertube/fragment/VideoMenuSpeedFragment.java
index c43f084..1fc333f 100644
--- a/app/src/main/java/net/schueller/peertube/fragment/VideoMenuSpeedFragment.java
+++ b/app/src/main/java/net/schueller/peertube/fragment/VideoMenuSpeedFragment.java
@@ -16,7 +16,9 @@
*/
package net.schueller.peertube.fragment;
+import android.content.SharedPreferences;
import android.os.Bundle;
+import android.preference.PreferenceManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -72,8 +74,7 @@ public class VideoMenuSpeedFragment extends BottomSheetDialogFragment {
TextView speed15 = view.findViewById(R.id.video_speed15);
TextView speed20 = view.findViewById(R.id.video_speed20);
- // Default
- setVideoSpeed(1.0f, speed10Icon);
+ setDefaultVideoSpeed();
// Attach the listener
speed05.setOnClickListener(v -> setVideoSpeed(0.5f, speed05Icon));
@@ -103,4 +104,30 @@ public class VideoMenuSpeedFragment extends BottomSheetDialogFragment {
new Iconics.Builder().on(icon).build();
}
+ private void setDefaultVideoSpeed() {
+ SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getContext());
+ String speed = sharedPref.getString(getString(R.string.pref_video_speed_key), "1.0");
+
+ switch (speed) {
+ case "0.5":
+ setVideoSpeed(0.5f, speed05Icon);
+ break;
+ case "0.75":
+ setVideoSpeed(0.75f, speed075Icon);
+ break;
+ case "1.0":
+ setVideoSpeed(1.0f, speed10Icon);
+ break;
+ case "1.25":
+ setVideoSpeed(1.25f, speed125Icon);
+ break;
+ case "1.5":
+ setVideoSpeed(1.5f, speed15Icon);
+ break;
+ case "2.0":
+ setVideoSpeed(2.0f, speed20Icon);
+ break;
+ }
+ }
+
}
\ No newline at end of file
diff --git a/app/src/main/java/net/schueller/peertube/service/VideoPlayerService.java b/app/src/main/java/net/schueller/peertube/service/VideoPlayerService.java
index 9c5fde3..a118a5f 100644
--- a/app/src/main/java/net/schueller/peertube/service/VideoPlayerService.java
+++ b/app/src/main/java/net/schueller/peertube/service/VideoPlayerService.java
@@ -24,6 +24,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.media.AudioManager;
@@ -32,6 +33,7 @@ import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
+import android.preference.PreferenceManager;
import android.webkit.URLUtil;
import androidx.annotation.Nullable;
@@ -255,8 +257,11 @@ public class VideoPlayerService extends Service {
// Auto play
player.setPlayWhenReady(true);
- //reset playback speed
- this.setPlayBackSpeed(1.0f);
+ //set playback speed to global default
+ SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
+ float speed = Float.parseFloat(sharedPref.getString(getString(R.string.pref_video_speed_key), "1.0"));
+
+ this.setPlayBackSpeed(speed);
playerNotificationManager = PlayerNotificationManager.createWithNotificationChannel(
context, PLAYBACK_CHANNEL_ID, R.string.playback_channel_name,
diff --git a/app/src/main/res/values/constants.xml b/app/src/main/res/values/constants.xml
index 72c48d6..36afab1 100644
--- a/app/src/main/res/values/constants.xml
+++ b/app/src/main/res/values/constants.xml
@@ -11,6 +11,7 @@
pref_show_nsfw
pref_language
+ pref_video_speed
pref_back_pause
pref_background_behavior
pref_torrent_player
@@ -582,4 +583,22 @@
- High
+
+ - 0.5x
+ - 0.75x
+ - Normal
+ - 1.25x
+ - 1.5x
+ - 2x
+
+
+
+ - 0.5
+ - 0.75
+ - 1.0
+ - 1.25
+ - 1.5
+ - 2.0
+
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 43befd3..45de62e 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -54,6 +54,8 @@
PeerTube Server
Background Playback
If enabled, continues to play video in background.
+ Default Playback Speed
+ Select the global Video Playback Speed
Pause on back button
Pause background play when pressing back during video playback.
Application Language
diff --git a/app/src/main/res/xml/root_preferences.xml b/app/src/main/res/xml/root_preferences.xml
index 2c76891..f8d2179 100644
--- a/app/src/main/res/xml/root_preferences.xml
+++ b/app/src/main/res/xml/root_preferences.xml
@@ -51,6 +51,15 @@
+
+