[Android] Properly handle vlc:// links

Nicolas Pomepuy git at videolan.org
Mon Mar 11 09:11:42 CET 2019


vlc-android | branch: bugfixes | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Mon Mar 11 09:11:36 2019 +0100| [0dffafbb8413d8494ed1ea1e602c8cca5d568cf0] | committer: Nicolas Pomepuy

Properly handle vlc:// links

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

 medialibrary/src/org/videolan/medialibrary/media/MediaWrapper.java | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/medialibrary/src/org/videolan/medialibrary/media/MediaWrapper.java b/medialibrary/src/org/videolan/medialibrary/media/MediaWrapper.java
index eb6e7333e..de55381b8 100644
--- a/medialibrary/src/org/videolan/medialibrary/media/MediaWrapper.java
+++ b/medialibrary/src/org/videolan/medialibrary/media/MediaWrapper.java
@@ -139,6 +139,8 @@ public class MediaWrapper extends MediaLibraryItem implements Parcelable {
 
         if (mrl.charAt(0) == '/')
             mrl = "file://"+mrl;
+        if (mrl.toLowerCase().startsWith("vlc://"))
+            mrl = mrl.substring(6);
         mUri = Uri.parse(mrl);
         mId = id;
         mFilename = filename;
@@ -175,6 +177,8 @@ public class MediaWrapper extends MediaLibraryItem implements Parcelable {
         if (uri == null)
             throw new NullPointerException("uri was null");
 
+        if (uri.toString().toLowerCase().startsWith("vlc://"))
+            uri = Uri.parse(uri.toString().substring(6));
         mUri = uri;
         init(null);
     }



More information about the Android mailing list