fix watch positions

This commit is contained in:
Bnyro 2022-07-07 15:58:51 +02:00
parent b93ae59e63
commit 9f907d34b5

View File

@ -514,14 +514,16 @@ class PlayerFragment : Fragment() {
private fun seekToWatchPosition() {
// seek to saved watch position if available
val watchPositions = PreferenceHelper.getWatchPositions(requireContext())
var position: Long? = null
watchPositions.forEach {
if (it.videoId == videoId) exoPlayer.seekTo(it.position)
if (it.videoId == videoId) position = it.position
}
// support for time stamped links
if (arguments?.getLong("timeStamp") != null) {
val position = arguments?.getLong("timeStamp")!! * 1000
exoPlayer.seekTo(position)
val timeStamp: Long? = arguments?.getLong("timeStamp")
if (timeStamp != null && timeStamp != 0L) {
position = timeStamp * 1000
}
if (position != null) exoPlayer.seekTo(position!!)
}
// the function is working recursively