[Android] Fix audio stream not saved in stream history the first time
Nicolas Pomepuy
git at videolan.org
Thu Jun 16 12:12:15 UTC 2022
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Jun 16 09:35:01 2022 +0200| [fc45f726a8e8c9e1808870008924ccda0968577c] | committer: Nicolas Pomepuy
Fix audio stream not saved in stream history the first time
Fixes #2571
> https://code.videolan.org/videolan/vlc-android/commit/fc45f726a8e8c9e1808870008924ccda0968577c
---
.../vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt | 6 ++++--
1 file changed, 4 insertions(+), 2 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 fd19d6d81..745ca83a5 100644
--- a/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -1035,6 +1035,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
}
private suspend fun savePlaycount(mw: MediaWrapper) {
+ var currentMedia = mw
if (settings.getBoolean(PLAYBACK_HISTORY, true) && !mw.uri.scheme.isSchemeFD()) withContext(Dispatchers.IO) {
var id = mw.id
if (id == 0L) {
@@ -1050,6 +1051,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
medialibrary.addMedia(mw.uri.toString(), mw.length)
}
if (internalMedia != null) {
+ currentMedia = internalMedia
id = internalMedia.id
getCurrentMedia()?.let { currentMedia -> if (internalMedia.title != currentMedia.title) internalMedia.rename(currentMedia.title) }
}
@@ -1061,8 +1063,8 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
* necessary to mark the media as played to add them to history and increment their
* playcount.
*/
- if (id != 0L && mw.type != MediaWrapper.TYPE_VIDEO && !canSwitchToVideo && !mw.isPodcast) {
- mw.markAsPlayed()
+ if (id != 0L && currentMedia.type != MediaWrapper.TYPE_VIDEO && !canSwitchToVideo && !currentMedia.isPodcast) {
+ currentMedia.markAsPlayed()
}
}
}
More information about the Android
mailing list