[Android] Change the time save when navigating play queue only for videos
Nicolas Pomepuy
git at videolan.org
Tue May 18 04:24:11 UTC 2021
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon May 17 14:02:26 2021 +0200| [354b72aba6f367cf8065416ad8c687c098b8544b] | committer: Nicolas Pomepuy
Change the time save when navigating play queue only for videos
Fixes #2018
> https://code.videolan.org/videolan/vlc-android/commit/354b72aba6f367cf8065416ad8c687c098b8544b
---
.../vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt | 6 +++---
1 file changed, 3 insertions(+), 3 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 3cc9a9db9..d3d41a7e9 100644
--- a/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -220,7 +220,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
@MainThread
fun next(force : Boolean = false) {
- mediaList.getMedia(currentIndex)?.time = player.getCurrentTime()
+ mediaList.getMedia(currentIndex)?.let { if (it.type == MediaWrapper.TYPE_VIDEO) it.time = player.getCurrentTime() }
val size = mediaList.size()
if (force || repeating != PlaybackStateCompat.REPEAT_MODE_ONE) {
previous.push(currentIndex)
@@ -276,7 +276,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
@MainThread
fun previous(force : Boolean) {
- mediaList.getMedia(currentIndex)?.time = player.getCurrentTime()
+ mediaList.getMedia(currentIndex)?.let { if (it.type == MediaWrapper.TYPE_VIDEO) it.time = player.getCurrentTime() }
if (hasPrevious() && currentIndex > 0 &&
((force || !player.seekable || (player.getCurrentTime() < PREVIOUS_LIMIT_DELAY) || (lastPrevious != -1L && System.currentTimeMillis() - lastPrevious < PREVIOUS_LIMIT_DELAY)))) {
val size = mediaList.size()
@@ -317,7 +317,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
}
suspend fun playIndex(index: Int, flags: Int = 0) {
- mediaList.getMedia(currentIndex)?.time = player.getCurrentTime()
+ mediaList.getMedia(currentIndex)?.let { if (it.type == MediaWrapper.TYPE_VIDEO) it.time = player.getCurrentTime() }
videoBackground = videoBackground || (!player.isVideoPlaying() && player.canSwitchToVideo())
if (mediaList.size() == 0) {
Log.w(TAG, "Warning: empty media list, nothing to play !")
More information about the Android
mailing list