[Android] Remote access: add the uploaded subtitle to the current video playback

Nicolas Pomepuy git at videolan.org
Wed Sep 9 06:43:36 UTC 2026


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Sep  1 07:53:01 2026 +0200| [4b611ecd53b46e64602c541b0f1138034cbdb592] | committer: Duncan McNamara

Remote access: add the uploaded subtitle to the current video playback

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

 .../videolan/vlc/remoteaccessserver/RemoteAccessRouting.kt    | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/application/remote-access-server/src/main/java/org/videolan/vlc/remoteaccessserver/RemoteAccessRouting.kt b/application/remote-access-server/src/main/java/org/videolan/vlc/remoteaccessserver/RemoteAccessRouting.kt
index 2056c41477..7df905a810 100644
--- a/application/remote-access-server/src/main/java/org/videolan/vlc/remoteaccessserver/RemoteAccessRouting.kt
+++ b/application/remote-access-server/src/main/java/org/videolan/vlc/remoteaccessserver/RemoteAccessRouting.kt
@@ -69,6 +69,7 @@ import kotlinx.coroutines.delay
 import kotlinx.coroutines.launch
 import kotlinx.coroutines.withContext
 import kotlinx.coroutines.withTimeout
+import org.videolan.libvlc.interfaces.IMedia
 import org.videolan.medialibrary.MLServiceLocator
 import org.videolan.medialibrary.interfaces.Medialibrary
 import org.videolan.medialibrary.interfaces.media.Album
@@ -108,6 +109,7 @@ import org.videolan.vlc.BuildConfig
 import org.videolan.vlc.gui.dialogs.getPlaylistByName
 import org.videolan.vlc.gui.helpers.AudioUtil
 import org.videolan.vlc.gui.helpers.BitmapUtil
+import org.videolan.vlc.repository.SlaveRepository
 import org.videolan.vlc.gui.helpers.FeedbackUtil
 import org.videolan.vlc.gui.helpers.VectorDrawableUtil
 import org.videolan.vlc.gui.helpers.getBitmapFromDrawable
@@ -267,6 +269,15 @@ fun Route.setupRouting(appContext: Context, scope: CoroutineScope) {
                     }
                     val fileBytes = part.streamProvider().readBytes()
                     file.writeBytes(fileBytes)
+
+                    val service = RemoteAccessServer.getInstance(appContext).service
+                    if (service?.isPlaying == true) {
+                        val uri = Uri.fromFile(file)
+                        service.addSubtitleTrack(uri, true)
+                        service.currentMediaWrapper?.let {
+                            SlaveRepository.getInstance(appContext).saveSlave(it.location, IMedia.Slave.Type.Subtitle, 2, uri.toString())
+                        }
+                    }
                 }
                 else -> {}
             }



More information about the Android mailing list