Skip to content
Snippets Groups Projects
Commit 0c4719e5 authored by Nicolas Pomepuy's avatar Nicolas Pomepuy
Browse files

Use a different storage for video and audio playback speeds

Fixes #1631
parent 959b6900
No related branches found
No related tags found
1 merge request!889Use a different storage for video and audio playback speeds
Pipeline #62033 passed with stage
in 3 minutes and 26 seconds
......@@ -81,7 +81,9 @@ const val VIDEO_SPEED = "VideoSpeed"
const val VIDEO_RATIO = "video_ratio"
const val LOGIN_STORE = "store_login"
const val KEY_PLAYBACK_RATE = "playback_rate"
const val KEY_PLAYBACK_RATE_VIDEO = "playback_rate_video"
const val KEY_PLAYBACK_SPEED_PERSIST = "playback_speed"
const val KEY_PLAYBACK_SPEED_PERSIST_VIDEO = "playback_speed_video"
const val KEY_VIDEO_APP_SWITCH = "video_action_switch"
const val VIDEO_TRANSITION_SHOW = "video_transition_show"
const val VIDEO_HUD_TIMEOUT = "video_hud_timeout"
......
......@@ -19,7 +19,7 @@
<CheckBoxPreference
app:singleLineTitle="false"
android:defaultValue="false"
android:key="playback_speed"
android:key="playback_speed_video"
android:summary="@string/playback_speed_summary"
android:title="@string/playback_speed_title"/>
<CheckBoxPreference
......
......@@ -18,10 +18,7 @@ import org.videolan.libvlc.interfaces.IVLCVout
import org.videolan.medialibrary.interfaces.media.MediaWrapper
import org.videolan.resources.VLCInstance
import org.videolan.resources.VLCOptions
import org.videolan.tools.KEY_PLAYBACK_RATE
import org.videolan.tools.KEY_PLAYBACK_SPEED_PERSIST
import org.videolan.tools.Settings
import org.videolan.tools.putSingle
import org.videolan.tools.*
import org.videolan.vlc.BuildConfig
import org.videolan.vlc.PlaybackService
import org.videolan.vlc.repository.SlaveRepository
......@@ -233,8 +230,8 @@ class PlayerController(val context: Context) : IVLCVout.Callback, MediaPlayer.Ev
fun setRate(rate: Float, save: Boolean) {
if (mediaplayer.isReleased) return
mediaplayer.rate = rate
if (save && settings.getBoolean(KEY_PLAYBACK_SPEED_PERSIST, false))
settings.putSingle(KEY_PLAYBACK_RATE, rate)
if (save && settings.getBoolean(if (isVideoPlaying()) KEY_PLAYBACK_SPEED_PERSIST_VIDEO else KEY_PLAYBACK_SPEED_PERSIST, false))
settings.putSingle(if (isVideoPlaying()) KEY_PLAYBACK_RATE_VIDEO else KEY_PLAYBACK_RATE, rate)
}
/**
......
......@@ -858,8 +858,8 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
}
if (player.getCurrentTime() % 10 == 0L) savePosition()
}
MediaPlayer.Event.SeekableChanged -> if (event.seekable && settings.getBoolean(KEY_PLAYBACK_SPEED_PERSIST, false)) {
player.setRate(settings.getFloat(KEY_PLAYBACK_RATE, 1.0f), false)
MediaPlayer.Event.SeekableChanged -> if (event.seekable && settings.getBoolean(if(player.isVideoPlaying()) KEY_PLAYBACK_SPEED_PERSIST_VIDEO else KEY_PLAYBACK_SPEED_PERSIST, false)) {
player.setRate(settings.getFloat(if(player.isVideoPlaying()) KEY_PLAYBACK_RATE_VIDEO else KEY_PLAYBACK_RATE, 1.0f), false)
}
}
service.onMediaPlayerEvent(event)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment