mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-27 23:40:33 +05:30
fix watch positions
This commit is contained in:
parent
5518de4176
commit
47fccb760a
@ -520,15 +520,19 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
|
||||
|
||||
// save the watch position if video isn't finished and option enabled
|
||||
private fun saveWatchPosition() {
|
||||
if (PlayerHelper.watchPositionsEnabled && exoPlayer.currentPosition != exoPlayer.duration) {
|
||||
if (!PlayerHelper.watchPositionsEnabled) return
|
||||
if (exoPlayer.currentPosition != exoPlayer.duration) {
|
||||
val watchPosition = WatchPosition(videoId!!, exoPlayer.currentPosition)
|
||||
query {
|
||||
Database.watchPositionDao().insertAll(WatchPosition(videoId!!, exoPlayer.currentPosition))
|
||||
Database.watchPositionDao().insertAll(watchPosition)
|
||||
}
|
||||
} else if (PlayerHelper.watchPositionsEnabled) {
|
||||
// delete watch position if video has ended
|
||||
query {
|
||||
Database.watchPositionDao().deleteById(videoId!!)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkForSegments() {
|
||||
if (!exoPlayer.isPlaying || !PlayerHelper.sponsorBlockEnabled) return
|
||||
|
Loading…
x
Reference in New Issue
Block a user