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

Save time when navigating the play queue

Fixes #1982
parent f27a53d5
No related branches found
No related tags found
1 merge request!951Save time when navigating the play queue
Pipeline #88237 passed with stage
in 2 minutes and 27 seconds
......@@ -220,6 +220,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
@MainThread
fun next(force : Boolean = false) {
mediaList.getMedia(currentIndex)?.time = player.getCurrentTime()
val size = mediaList.size()
if (force || repeating != PlaybackStateCompat.REPEAT_MODE_ONE) {
previous.push(currentIndex)
......@@ -275,6 +276,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
@MainThread
fun previous(force : Boolean) {
mediaList.getMedia(currentIndex)?.time = player.getCurrentTime()
if (hasPrevious() && currentIndex > 0 &&
((force || !player.seekable || (player.getCurrentTime() < PREVIOUS_LIMIT_DELAY) || (lastPrevious != -1L && System.currentTimeMillis() - lastPrevious < PREVIOUS_LIMIT_DELAY)))) {
val size = mediaList.size()
......@@ -315,6 +317,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
}
suspend fun playIndex(index: Int, flags: Int = 0) {
mediaList.getMedia(currentIndex)?.time = player.getCurrentTime()
videoBackground = videoBackground || (!player.isVideoPlaying() && player.canSwitchToVideo())
if (mediaList.size() == 0) {
Log.w(TAG, "Warning: empty media list, nothing to play !")
......
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