CastTrackSelector


@UnstableApi
abstract class CastTrackSelector


Handles track selections and parameter changes for RemoteCastPlayer.

See evaluate for the most important uses of this class.

An instance of this class must not be reused across different RemoteCastPlayer instances. A new instance must be created for each player.

Summary

Nested types

Holds parameters associated with a evaluation request.

The result of a track selection.

A builder for CastTrackSelectorResult.

The reason for track selection request.

Constants

const Int

The selection request is the result of a call to invalidate.

const Int

The selection request is the result of a call to setTrackSelectionParameters.

const Int

The selection request is the result of an update from the Cast receiver app.

Protected constructors

Constructor.

Public functions

abstract CastTrackSelector.CastTrackSelectorResult!

Called by RemoteCastPlayer to optionally change the current track selections and/or parameters.

Unit

Triggers a new call to evaluate, so as to change the selected tracks.

Constants

TRACK_SELECTION_REQUEST_REASON_INVALIDATION

const val TRACK_SELECTION_REQUEST_REASON_INVALIDATION = 0: Int

The selection request is the result of a call to invalidate.

TRACK_SELECTION_REQUEST_REASON_PARAMETER_CHANGE

const val TRACK_SELECTION_REQUEST_REASON_PARAMETER_CHANGE = 2: Int

The selection request is the result of a call to setTrackSelectionParameters.

TRACK_SELECTION_REQUEST_REASON_RECEIVER_UPDATE

const val TRACK_SELECTION_REQUEST_REASON_RECEIVER_UPDATE = 1: Int

The selection request is the result of an update from the Cast receiver app.

Protected constructors

CastTrackSelector

protected CastTrackSelector()

Constructor.

Public functions

evaluate

abstract fun evaluate(request: CastTrackSelector.CastTrackSelectorRequest!): CastTrackSelector.CastTrackSelectorResult!

Called by RemoteCastPlayer to optionally change the current track selections and/or parameters.

You can implement this method to change the currently active tracks through selections. For example, in response to a change in the current track selection parameters, available through trackSelectionParameters.

Alternatively, you can also change the current track selection parameters in response to a receiver app track selection change.

You can trigger a call to this method by calling invalidate, or by changing the track selection parameters.

Parameters
request: CastTrackSelector.CastTrackSelectorRequest!

The CastTrackSelectorRequest that contains the current state to evaluate in order to provide a CastTrackSelectorResult with updated track selections or parameters.

Returns
CastTrackSelector.CastTrackSelectorResult!

A CastTrackSelectorResult to update the state of RemoteCastPlayer and the receiver Cast application.

invalidate

fun invalidate(): Unit

Triggers a new call to evaluate, so as to change the selected tracks.

Must be called on the main thread.