selectVariant

suspend fun selectVariant(index: Int?)

Plays the variant at index of Tracks.variants, or chooses one again by the item's DemuxPolicy when index is null. The media opens again on that variant at the current position, through the same rebuild as a video track change, and keeps playing or stays paused. The choice is kept on the item, so a later rebuild keeps it too.

A selected variant stays. With null, the player changes the variant by itself as the network allows: down when the link cannot carry it, and up when MediaIo.networkBitsPerSecond shows room to spare for a higher one. Each change opens the stream again, so the picture holds for a moment.

Throws

when nothing is open, or when a stop, a close, a new open or a later call ended the change first.

when the media has no variant at index.

when the source cannot seek back to the position.

when the reopen itself failed.