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