[Android] Remote access: generate browser items using the ml MediaWrapper if possible
Nicolas Pomepuy
git at videolan.org
Wed Aug 27 12:48:55 UTC 2025
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Aug 20 14:51:45 2025 +0200| [d89e83b69016eb40ef736dda93843d4ec202814c] | committer: Nicolas Pomepuy
Remote access: generate browser items using the ml MediaWrapper if possible
> https://code.videolan.org/videolan/vlc-android/commit/d89e83b69016eb40ef736dda93843d4ec202814c
---
.../vlc/remoteaccessserver/RemoteAccessRouting.kt | 16 +++++++++++++---
.../vlc/remoteaccessserver/RemoteAccessServer.kt | 2 +-
2 files changed, 14 insertions(+), 4 deletions(-)
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 79930202c8..1f15c43d97 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
@@ -944,8 +944,18 @@ fun Route.setupRouting(appContext: Context, scope: CoroutineScope) {
else -> "file"
}
}
- RemoteAccessServer.PlayQueueItem(1000L + index, title, it.description ?: "", 0, it.artworkMrl
- ?: "", false, "", filePath, isFolder, fileType = fileType)
+ val id = if (it is MediaWrapper && it.id > 0) it.id else 1000L + index
+ val played = if (it is MediaWrapper) it.seen > 0 else false
+
+ if (it is MediaWrapper && it.id > 0) {
+ it.toPlayQueueItem().apply {
+ this.fileType = fileType
+ this.artist = it.description
+ }
+ } else
+ RemoteAccessServer.PlayQueueItem(
+ id, title, it.description ?: "", 0, it.artworkMrl
+ ?: "", false, "", filePath, isFolder, fileType = fileType, played = played)
}
//segments
@@ -1616,7 +1626,7 @@ fun Playlist.toPlayQueueItem(appContext: Context) = RemoteAccessServer.PlayQueue
?: "", false, "", favorite = isFavorite)
fun MediaWrapper.toPlayQueueItem(defaultArtist: String = "") = RemoteAccessServer.PlayQueueItem(id, title, artistName?.ifEmpty { defaultArtist } ?: defaultArtist, length, artworkMrl
- ?: "", false, generateResolutionClass(width, height) ?: "", progress = time, played = seen > 0, favorite = isFavorite)
+ ?: "", false, generateResolutionClass(width, height) ?: "", progress = time, played = seen > 0, favorite = isFavorite, path = uri.toString())
fun Folder.toPlayQueueItem(context: Context) = RemoteAccessServer.PlayQueueItem(id, title, context.resources.getQuantityString(org.videolan.vlc.R.plurals.videos_quantity, mediaCount(Folder.TYPE_FOLDER_VIDEO), mediaCount(Folder.TYPE_FOLDER_VIDEO))
?: "", 0, artworkMrl
diff --git a/application/remote-access-server/src/main/java/org/videolan/vlc/remoteaccessserver/RemoteAccessServer.kt b/application/remote-access-server/src/main/java/org/videolan/vlc/remoteaccessserver/RemoteAccessServer.kt
index 81606c7877..e83c13dce7 100644
--- a/application/remote-access-server/src/main/java/org/videolan/vlc/remoteaccessserver/RemoteAccessServer.kt
+++ b/application/remote-access-server/src/main/java/org/videolan/vlc/remoteaccessserver/RemoteAccessServer.kt
@@ -1000,7 +1000,7 @@ class RemoteAccessServer(private val context: Context) : PlaybackService.Callbac
data class WSChapter(val title: String, val time: Long)
data class PlayQueue(val medias: List<PlayQueueItem>) : WSMessage(WSMessageType.PLAY_QUEUE)
- data class PlayQueueItem(val id: Long, val title: String, val artist: String, val duration: Long, val artworkURL: String, val playing: Boolean, val resolution: String = "", val path: String = "", val isFolder: Boolean = false, val progress: Long = 0L, val played: Boolean = false, var fileType: String = "", val favorite: Boolean = false)
+ data class PlayQueueItem(val id: Long, val title: String, var artist: String, val duration: Long, val artworkURL: String, val playing: Boolean, val resolution: String = "", val path: String = "", val isFolder: Boolean = false, val progress: Long = 0L, val played: Boolean = false, var fileType: String = "", val favorite: Boolean = false)
data class WebSocketAuthorization(val status:String, val initialMessage:String) : WSMessage(WSMessageType.AUTH)
data class Volume(val volume: Int) : WSMessage(WSMessageType.VOLUME)
data class PlayerStatus(val playing: Boolean) : WSMessage(WSMessageType.PLAYER_STATUS)
More information about the Android
mailing list