Merge pull request #1005 from Bnyro/master

background mode playback speed option
This commit is contained in:
Bnyro 2022-08-09 15:07:41 +02:00 committed by GitHub
commit 85037be09b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 1 deletions

View File

@ -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
*/

View File

@ -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
}
}

View File

@ -296,4 +296,5 @@
<string name="skip_buttons_summary">Show buttons to skip to the next or previous video.</string>
<string name="history_size">Maximum history size</string>
<string name="unlimited">Unlimited</string>
<string name="background_mode">Background mode</string>
</resources>

View File

@ -120,4 +120,17 @@
</PreferenceCategory>
<PreferenceCategory app:title="@string/background_mode">
<ListPreference
android:icon="@drawable/ic_speed"
app:defaultValue="1"
app:entries="@array/playbackSpeed"
app:entryValues="@array/playbackSpeedValues"
app:key="background_playback_speed"
app:title="@string/playback_speed"
app:useSimpleSummaryProvider="true" />
</PreferenceCategory>
</PreferenceScreen>