[Android] Allow picking subtitles for media that are not local or network files
Nicolas Pomepuy
git at videolan.org
Wed Jan 20 09:54:26 UTC 2021
vlc-android | branch: 3.3.x | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Dec 16 11:27:24 2020 +0100| [1bba3ccdf9e09623aa8c0cfe58b22e35ba3983fc] | committer: Nicolas Pomepuy
Allow picking subtitles for media that are not local or network files
Fixes #1582
(cherry picked from commit 6e8d63bce061be2ec4f74ae8b30c3ece41c3c0e0)
> https://code.videolan.org/videolan/vlc-android/commit/1bba3ccdf9e09623aa8c0cfe58b22e35ba3983fc
---
.../src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt
index ba14f457e..53c0b28b5 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt
@@ -73,6 +73,8 @@ import org.videolan.vlc.gui.helpers.UiTools.showVideoTrack
import org.videolan.vlc.gui.view.PlayerProgress
import org.videolan.vlc.media.MediaUtils
import org.videolan.vlc.util.FileUtils
+import org.videolan.vlc.util.isSchemeFile
+import org.videolan.vlc.util.isSchemeNetwork
import org.videolan.vlc.viewmodels.PlaylistModel
@ExperimentalCoroutinesApi
@@ -735,7 +737,7 @@ class VideoPlayerOverlayDelegate (private val player: VideoPlayerActivity) {
private fun pickSubtitles() {
val uri = player.videoUri ?: return
- val media = MediaWrapperImpl(FileUtils.getParent(uri.toString())!!.toUri())
+ val media = if (uri.scheme.isSchemeFile() || uri.scheme.isSchemeNetwork()) MediaWrapperImpl(FileUtils.getParent(uri.toString())!!.toUri()) else null
player.isShowingDialog = true
val filePickerIntent = Intent(player, FilePickerActivity::class.java)
filePickerIntent.putExtra(KEY_MEDIA, media)
More information about the Android
mailing list