Use the correct setMediaItems overload to make onPlaybackStatsReady behave correctly

This commit is contained in:
vfsfitvnm 2022-10-10 11:15:23 +02:00
parent 6d2b075720
commit ff611d792e
2 changed files with 3 additions and 4 deletions

View file

@ -379,9 +379,9 @@ class PlayerService : InvincibleService(), Player.Listener, PlaybackStatsListene
.setCustomCacheKey(mediaItem.mediaItem.mediaId)
.build()
},
true
index,
queuedSong[index].position ?: C.TIME_UNSET
)
player.seekTo(index, queuedSong[index].position ?: 0)
player.prepare()
isNotificationStarted = true

View file

@ -43,9 +43,8 @@ fun Player.forcePlay(mediaItem: MediaItem) {
fun Player.forcePlayAtIndex(mediaItems: List<MediaItem>, mediaItemIndex: Int) {
if (mediaItems.isEmpty()) return
setMediaItems(mediaItems, true)
setMediaItems(mediaItems, mediaItemIndex, C.TIME_UNSET)
playWhenReady = true
seekToDefaultPosition(mediaItemIndex)
prepare()
}