public final class RandomTrackSelection extends BaseTrackSelection
TrackSelection
whose selected track is updated randomly.Modifier and Type | Class and Description |
---|---|
static class |
RandomTrackSelection.Factory
Factory for
RandomTrackSelection instances. |
group, length, tracks
Constructor and Description |
---|
RandomTrackSelection(TrackGroup group,
int... tracks) |
RandomTrackSelection(TrackGroup group,
int[] tracks,
long seed) |
RandomTrackSelection(TrackGroup group,
int[] tracks,
Random random) |
Modifier and Type | Method and Description |
---|---|
int |
getSelectedIndex()
Returns the index of the selected track.
|
Object |
getSelectionData()
Returns optional data associated with the current track selection.
|
int |
getSelectionReason()
Returns the reason for the current track selection.
|
void |
updateSelectedTrack(long bufferedDurationUs)
Updates the selected track.
|
blacklist, equals, evaluateQueueSize, getFormat, getIndexInTrackGroup, getSelectedFormat, getSelectedIndexInTrackGroup, getTrackGroup, hashCode, indexOf, indexOf, isBlacklisted, length
public RandomTrackSelection(TrackGroup group, int... tracks)
group
- The TrackGroup
. Must not be null.tracks
- The indices of the selected tracks within the TrackGroup
. Must not be
null or empty. May be in any order.public RandomTrackSelection(TrackGroup group, int[] tracks, long seed)
group
- The TrackGroup
. Must not be null.tracks
- The indices of the selected tracks within the TrackGroup
. Must not be
null or empty. May be in any order.seed
- A seed for the Random
instance used to update the selected track.public RandomTrackSelection(TrackGroup group, int[] tracks, Random random)
group
- The TrackGroup
. Must not be null.tracks
- The indices of the selected tracks within the TrackGroup
. Must not be
null or empty. May be in any order.random
- A source of random numbers.public void updateSelectedTrack(long bufferedDurationUs)
TrackSelection
bufferedDurationUs
- The duration of media currently buffered in microseconds.public int getSelectedIndex()
TrackSelection
public int getSelectionReason()
TrackSelection
public Object getSelectionData()
TrackSelection