[Android] Use the initial mrl to save the metadata of an expanded media
Nicolas Pomepuy
git at videolan.org
Mon Jun 20 12:04:02 UTC 2022
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Jun 20 13:27:15 2022 +0200| [f467298e7cbec1bb45d332e1db6fb52c6c206445] | committer: Nicolas Pomepuy
Use the initial mrl to save the metadata of an expanded media
Fixes #2430
> https://code.videolan.org/videolan/vlc-android/commit/f467298e7cbec1bb45d332e1db6fb52c6c206445
---
.../vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt | 7 +++----
1 file changed, 3 insertions(+), 4 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 745ca83a5..5bc0f9799 100644
--- a/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -518,7 +518,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
val canSwitchToVideo = player.canSwitchToVideo()
val rate = player.getRate()
launch(Dispatchers.IO) innerLaunch@ {
- val media = medialibrary.findMedia(currentMedia) ?: return at innerLaunch
+ val media = if (entryUrl != null) medialibrary.getMedia(entryUrl) else medialibrary.findMedia(currentMedia) ?: return at innerLaunch
if (media.id == 0L) return at innerLaunch
if (titleIdx > 0) media.setLongMeta(MediaWrapper.META_TITLE, titleIdx.toLong())
//checks if the [MediaPlayer] has not been reset in the meantime to prevent saving 0
@@ -711,6 +711,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
*/
@MainThread
private suspend fun expand(updateHistory: Boolean): Int {
+ entryUrl = null
if (BuildConfig.BETA) Log.d(TAG, "expand with values: ", Exception("Call stack"))
val index = currentIndex
val expandedMedia = getCurrentMedia()
@@ -1044,9 +1045,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
id = internalMedia.id
} else {
internalMedia = if (mw.type == MediaWrapper.TYPE_STREAM || isSchemeStreaming(mw.uri.scheme)) {
- medialibrary.addStream(entryUrl ?: mw.uri.toString(), mw.title).also {
- entryUrl = null
- }
+ medialibrary.addStream(entryUrl ?: mw.uri.toString(), mw.title)
} else {
medialibrary.addMedia(mw.uri.toString(), mw.length)
}
More information about the Android
mailing list