addToQueue

suspend fun addToQueue(items: List<MediaItem>, index: Int? = null)

Inserts items at index, or at the end when index is null.

The item that is playing keeps playing and is not reopened. PlayerSnapshot.queueIndex follows it, so it moves by items size when the insert lands in front of it.

A plain open counts as a queue of one here: the first edit writes that queue down rather than refusing, so adding a second item never has to reopen the first.

Throws

for an empty list, or an index outside 0..queue size. That upper bound is inclusive, because one past the end is where an append goes.

when nothing is open at all.


suspend fun addToQueue(item: MediaItem, index: Int? = null)

Inserts one item. See the list overload for everything else.