mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 22:30:30 +05:30
Merge pull request #1005 from Bnyro/master
background mode playback speed option
This commit is contained in:
commit
85037be09b
@ -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
|
||||
*/
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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>
|
||||
|
@ -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>
|
Loading…
Reference in New Issue
Block a user