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

Nicolas Pomepuy git at videolan.org
Wed Jan 20 09:54:27 UTC 2021


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

Audio: improve resume playback after killing the app

Fixes #1603

(cherry picked from commit da290b513ba7b3bd28d17fdde3d994088f2b9856)

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

 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