[Android] Fix playback when previous track is removed

Geoffrey Métais git at videolan.org
Wed Jan 31 13:27:12 CET 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Jan 31 13:26:20 2018 +0100| [057283f1cccb4036c08ac8c11aae07756f11205d] | committer: Geoffrey Métais

Fix playback when previous track is removed

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

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

diff --git a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
index ef058927a..d42b185ec 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -327,10 +327,11 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
 
     override fun onItemRemoved(index: Int, mrl: String?) {
         if (BuildConfig.DEBUG) Log.i(TAG, "CustomMediaListItemDeleted")
+        val currentRemoved = currentIndex == index
         if (currentIndex >= index && !expanding) --currentIndex
         launch(UI, CoroutineStart.UNDISPATCHED) {
             determinePrevAndNextIndices()
-            if (currentIndex == index && !expanding) {
+            if (currentRemoved && !expanding) {
                 when {
                     nextIndex != -1 -> next()
                     currentIndex != -1 -> playIndex(currentIndex, 0)



More information about the Android mailing list