CastTrackMatcher

Receiver track IDs are assigned by the receiver from its own manifest parse (plus the sender's sideloaded caption tracks), so local track order need not match. Matching mirrors the web sender: language exact → language primary subtag → name.

Functions

Link copied to clipboard
fun buildActiveTrackIds(tracks: List<RemoteTrack>, currentActiveIds: List<Long>, replaceAudio: Boolean, newTrackId: Long?): LongArray

Build the replacement active-track-id list. The request replaces the whole active set, so active tracks of the other type must be preserved (switching audio must not turn captions off and vice versa). Passing a null newTrackId deactivates the type entirely (captions off).

Link copied to clipboard
fun pickTrack(tracks: List<RemoteTrack>, audio: Boolean, language: String?, name: String?): RemoteTrack?