fix: videos played with background player not added to watch history

This commit is contained in:
Bnyro 2023-09-10 12:28:20 +02:00
parent e6df9c7038
commit 62ff36b77c

View File

@ -275,6 +275,13 @@ class OnlinePlayerService : LifecycleService() {
Player.STATE_BUFFERING -> {} Player.STATE_BUFFERING -> {}
Player.STATE_READY -> { Player.STATE_READY -> {
isTransitioning = false isTransitioning = false
// save video to watch history when the video starts playing or is being resumed
// waiting for the player to be ready since the video can't be claimed to be watched
// while it did not yet start actually, but did buffer only so far
lifecycleScope.launch(Dispatchers.IO) {
streams?.let { DatabaseHelper.addToWatchHistory(videoId, it) }
}
} }
} }
} }