TrackChange

sealed interface TrackChange

What happened to one KitePlayer.selectTrack call.

There is a result type here because the answer is genuinely not a boolean and genuinely not always success. Only one selection of a kind can be pending at a time, so two callers asking for two different audio tracks at once means one of them does not get what it asked for, and the engine used to complete BOTH of them normally: the loser was told its track was selected while a different one was playing. A stop, a close and a call made against no open media did the same. Each of those now has its own answer.

A selection that fails because the media or the device failed still throws PlaybackException, and one made with a track id of the wrong kind, on an unseekable source, or for a format no decoder reads still throws, because those are mistakes in the calling code. This type is for the outcomes that are nobody's mistake.

Inheritors

Types

Link copied to clipboard
data class Applied(val kind: TrackKind, val track: TrackId?) : TrackChange

This request is the live selection: track of kind is what the player is using now.

Link copied to clipboard
data class Discarded(val reason: String) : TrackChange

The request ended without applying and without being replaced: a stop or a close arrived first, or there was no longer an open media item to apply it to. reason says which.

Link copied to clipboard
data class Superseded(val kind: TrackKind, val by: TrackId?) : TrackChange

A later KitePlayer.selectTrack replaced this request before it ran, and by is what the player applied instead. Nothing of this request is live.