[Android] VideoPlayer: fix vob videos restarting at the end
Duncan McNamara
git at videolan.org
Thu Feb 13 10:11:39 UTC 2025
vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Thu Jan 30 16:48:55 2025 +0100| [343f6695d1bcb113f2dfae71054f18fff995260c] | committer: Nicolas Pomepuy
VideoPlayer: fix vob videos restarting at the end
The Medialibrary sometimes doesn't have the media's length,
and won't know that the file has ended.
For some files this causes a finished video to keep it's time and when
played again starts at the end, and leave the player.
This forces the ML to mark the file as finished and reset it's time
> https://code.videolan.org/videolan/vlc-android/commit/343f6695d1bcb113f2dfae71054f18fff995260c
---
.../src/org/videolan/vlc/media/PlaylistManager.kt | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
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 63eb27c1d7..6960b11443 100644
--- a/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -675,7 +675,18 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
Medialibrary.ML_SET_TIME_ERROR -> {
}
Medialibrary.ML_SET_TIME_END, Medialibrary.ML_SET_TIME_BEGIN -> media.time = 0
- Medialibrary.ML_SET_TIME_AS_IS -> media.time = time
+ Medialibrary.ML_SET_TIME_AS_IS -> {
+ media.time = time
+ // the Medialibrary sometimes doesn't have the media's length,
+ // and won't know that the file has ended. This forces the ML
+ // to mark the file as finished and reset it's time
+ if (time == length) {
+ medialibrary.setLastTime(media.id, 0)
+ media.seen = 1L
+ media.playCount += 1
+ media.time = 0
+ }
+ }
}
} catch (e: NullPointerException) {
VLCCrashHandler.saveLog(e, "NullPointerException in PlaylistManager saveMediaMeta")
More information about the Android
mailing list