[Android] Audio: improve resume playback after killing the app

Nicolas Pomepuy git at videolan.org
Fri Jan 8 09:10:05 UTC 2021


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Jan  7 09:36:36 2021 +0100| [da290b513ba7b3bd28d17fdde3d994088f2b9856] | committer: Nicolas Pomepuy

Audio: improve resume playback after killing the app

Fixes #1603

> https://code.videolan.org/videolan/vlc-android/commit/da290b513ba7b3bd28d17fdde3d994088f2b9856
---

 application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt b/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
index d209114ea..07fa5db15 100644
--- a/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -821,7 +821,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
                         loadMediaMeta(mw)
                         mw.length = player.getLength()
                         saveMediaList()
-                        savePosition(reset = true)
+                        savePosition()
                         saveCurrentMedia()
                         newMedia = false
                         if (player.hasRenderer || !player.isVideoPlaying()) showAudioPlayer.value = true
@@ -856,6 +856,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
                     abRepeat.value?.let {
                         if (it.stop != -1L && player.getCurrentTime() > it.stop) player.seek(it.start)
                     }
+                    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)



More information about the Android mailing list