[Android] Always swap file media with ML media when browsing to display progress and read state

Nicolas Pomepuy git at videolan.org
Tue Nov 24 09:39:49 CET 2020


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Nov 10 10:28:02 2020 +0100| [bf28d0594331c27cdd4fe3881838d3a09265485b] | committer: Hugo Beauzée-Luyssen

Always swap file media with ML media when browsing to display progress and read state

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

 .../vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt        | 2 ++
 .../vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt    | 5 +++--
 2 files changed, 5 insertions(+), 2 deletions(-)

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 b19b0dc77..c58b5edcd 100644
--- a/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -454,6 +454,8 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
                 }
                 media.time = if (progress == 0f) 0L else time
                 media.setLongMeta(MediaWrapper.META_PROGRESS, media.time)
+                //todo verify that this info is persisted in DB
+                if (media.length <= 0 && length > 0) media.length = length
             }
             media.setStringMeta(MediaWrapper.META_SPEED, rate.toString())
         }
diff --git a/application/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt b/application/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
index 465442a95..f5a275899 100644
--- a/application/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
+++ b/application/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
@@ -24,6 +24,7 @@ import android.content.Context
 import android.os.Handler
 import android.os.HandlerThread
 import android.os.Process
+import android.util.Log
 import androidx.collection.SimpleArrayMap
 import androidx.lifecycle.MutableLiveData
 import kotlinx.coroutines.*
@@ -44,6 +45,7 @@ import org.videolan.resources.VLCInstance
 import org.videolan.resources.util.HeaderProvider
 import org.videolan.tools.*
 import org.videolan.tools.livedata.LiveDataset
+import org.videolan.vlc.BuildConfig
 import org.videolan.vlc.R
 import org.videolan.vlc.util.*
 import java.io.File
@@ -333,8 +335,7 @@ abstract class BrowserProvider(val context: Context, val dataset: LiveDataset<Me
             else if (!showAll) return null
         }
         val uri = mw.uri
-        if ((mw.type == MediaWrapper.TYPE_AUDIO || mw.type == MediaWrapper.TYPE_VIDEO)
-                && "file" == uri.scheme) return withContext(coroutineContextProvider.IO) {
+        if ((mw.type == MediaWrapper.TYPE_AUDIO || mw.type == MediaWrapper.TYPE_VIDEO)) return withContext(coroutineContextProvider.IO) {
             medialibrary.getMedia(uri) ?: mw
         }
         return mw



More information about the Android mailing list