playback: fix playNext wraparound with Repeat All
ExoPlayer method for fetching next media item respects Repeat All, which on the last song of a queue causes playNext to wrap around and insert the songs at the start of the queue. New code fetches next song as if repeat were turned off, so the songs will always be added to the end of the queue.
This commit is contained in:
parent
c6b960466b
commit
1d9dc34549
1 changed files with 11 additions and 1 deletions
|
|
@ -377,7 +377,17 @@ class PlaybackService :
|
|||
}
|
||||
|
||||
override fun playNext(songs: List<Song>, ack: StateAck.PlayNext) {
|
||||
val nextIndex = player.nextMediaItemIndex
|
||||
val currTimeline = player.currentTimeline
|
||||
val nextIndex =
|
||||
if (currTimeline.isEmpty) {
|
||||
C.INDEX_UNSET
|
||||
} else {
|
||||
currTimeline.getNextWindowIndex(
|
||||
player.currentMediaItemIndex,
|
||||
Player.REPEAT_MODE_OFF,
|
||||
player.shuffleModeEnabled
|
||||
)
|
||||
}
|
||||
|
||||
if (nextIndex == C.INDEX_UNSET) {
|
||||
player.addMediaItems(songs.map { it.toMediaItem() })
|
||||
|
|
|
|||
Loading…
Reference in a new issue