Use the correct setMediaItems overload to make onPlaybackStatsReady behave correctly
This commit is contained in:
parent
6d2b075720
commit
ff611d792e
2 changed files with 3 additions and 4 deletions
|
@ -379,9 +379,9 @@ class PlayerService : InvincibleService(), Player.Listener, PlaybackStatsListene
|
||||||
.setCustomCacheKey(mediaItem.mediaItem.mediaId)
|
.setCustomCacheKey(mediaItem.mediaItem.mediaId)
|
||||||
.build()
|
.build()
|
||||||
},
|
},
|
||||||
true
|
index,
|
||||||
|
queuedSong[index].position ?: C.TIME_UNSET
|
||||||
)
|
)
|
||||||
player.seekTo(index, queuedSong[index].position ?: 0)
|
|
||||||
player.prepare()
|
player.prepare()
|
||||||
|
|
||||||
isNotificationStarted = true
|
isNotificationStarted = true
|
||||||
|
|
|
@ -43,9 +43,8 @@ fun Player.forcePlay(mediaItem: MediaItem) {
|
||||||
fun Player.forcePlayAtIndex(mediaItems: List<MediaItem>, mediaItemIndex: Int) {
|
fun Player.forcePlayAtIndex(mediaItems: List<MediaItem>, mediaItemIndex: Int) {
|
||||||
if (mediaItems.isEmpty()) return
|
if (mediaItems.isEmpty()) return
|
||||||
|
|
||||||
setMediaItems(mediaItems, true)
|
setMediaItems(mediaItems, mediaItemIndex, C.TIME_UNSET)
|
||||||
playWhenReady = true
|
playWhenReady = true
|
||||||
seekToDefaultPosition(mediaItemIndex)
|
|
||||||
prepare()
|
prepare()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue