Workaround exoplayer bug
This commit is contained in:
@@ -104,6 +104,7 @@ import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.cancellable
|
||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||
import kotlinx.coroutines.flow.first
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.plus
|
||||
import kotlinx.coroutines.runBlocking
|
||||
@@ -297,6 +298,8 @@ class PlayerService : InvincibleService(), Player.Listener, PlaybackStatsListene
|
||||
|
||||
if (totalPlayTimeMs > 30000) {
|
||||
query {
|
||||
// THANKS, EXOPLAYER
|
||||
if (runBlocking { Database.song(mediaItem.mediaId).first() } != null) {
|
||||
Database.insert(
|
||||
Event(
|
||||
songId = mediaItem.mediaId,
|
||||
@@ -307,6 +310,7 @@ class PlayerService : InvincibleService(), Player.Listener, PlaybackStatsListene
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onMediaItemTransition(mediaItem: MediaItem?, reason: Int) {
|
||||
maybeRecoverPlaybackError()
|
||||
|
||||
Reference in New Issue
Block a user