Browse Source

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
merge-requests/2174/head
Duncan McNamara 2 years ago
committed by Nicolas Pomepuy
parent
commit
343f6695d1
  1. 13
      application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt

13
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")

Loading…
Cancel
Save