diff --git a/app/src/main/java/com/github/libretube/preferences/PreferenceKeys.kt b/app/src/main/java/com/github/libretube/preferences/PreferenceKeys.kt
index 74f110a6d..3b4c4ad55 100644
--- a/app/src/main/java/com/github/libretube/preferences/PreferenceKeys.kt
+++ b/app/src/main/java/com/github/libretube/preferences/PreferenceKeys.kt
@@ -59,6 +59,11 @@ object PreferenceKeys {
const val DEFAULT_SUBTITLE = "default_subtitle"
const val SKIP_BUTTONS = "skip_buttons"
+ /**
+ * Background mode
+ */
+ const val BACKGROUND_PLAYBACK_SPEED = "background_playback_speed"
+
/**
* Download
*/
diff --git a/app/src/main/java/com/github/libretube/services/BackgroundMode.kt b/app/src/main/java/com/github/libretube/services/BackgroundMode.kt
index c22a889e1..c3ae20dac 100644
--- a/app/src/main/java/com/github/libretube/services/BackgroundMode.kt
+++ b/app/src/main/java/com/github/libretube/services/BackgroundMode.kt
@@ -159,6 +159,13 @@ class BackgroundMode : Service() {
// seek to the previous position if available
if (seekToPosition != 0L) player?.seekTo(seekToPosition)
+ // set the playback speed
+ val playbackSpeed = PreferenceHelper.getString(
+ PreferenceKeys.BACKGROUND_PLAYBACK_SPEED,
+ "1"
+ ).toFloat()
+ player?.setPlaybackSpeed(playbackSpeed)
+
fetchSponsorBlockSegments()
setNextStream()
@@ -301,6 +308,6 @@ class BackgroundMode : Service() {
}
override fun onBind(p0: Intent?): IBinder? {
- TODO("Not yet implemented")
+ return null
}
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 25d950e58..cc4981bce 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -296,4 +296,5 @@
Show buttons to skip to the next or previous video.
Maximum history size
Unlimited
+ Background mode
diff --git a/app/src/main/res/xml/player_settings.xml b/app/src/main/res/xml/player_settings.xml
index 9e72d25dc..b3b646ed0 100644
--- a/app/src/main/res/xml/player_settings.xml
+++ b/app/src/main/res/xml/player_settings.xml
@@ -120,4 +120,17 @@
+
+
+
+
+
+
\ No newline at end of file