AdaptiveTrackSelection.Factory


class AdaptiveTrackSelection.Factory : ExoTrackSelection.Factory


Factory for AdaptiveTrackSelection instances.

Summary

Public constructors

Creates an adaptive track selection factory with default parameters.

Factory(
    minDurationForQualityIncreaseMs: Int,
    maxDurationForQualityDecreaseMs: Int,
    minDurationToRetainAfterDiscardMs: Int,
    bandwidthFraction: Float
)

Creates an adaptive track selection factory.

Factory(
    minDurationForQualityIncreaseMs: Int,
    maxDurationForQualityDecreaseMs: Int,
    minDurationToRetainAfterDiscardMs: Int,
    bandwidthFraction: Float,
    bufferedFractionToLiveEdgeForQualityIncrease: Float,
    clock: Clock!
)

Creates an adaptive track selection factory.

Factory(
    minDurationForQualityIncreaseMs: Int,
    maxDurationForQualityDecreaseMs: Int,
    minDurationToRetainAfterDiscardMs: Int,
    maxWidthToDiscard: Int,
    maxHeightToDiscard: Int,
    bandwidthFraction: Float
)

Creates an adaptive track selection factory.

Factory(
    minDurationForQualityIncreaseMs: Int,
    maxDurationForQualityDecreaseMs: Int,
    minDurationToRetainAfterDiscardMs: Int,
    maxWidthToDiscard: Int,
    maxHeightToDiscard: Int,
    bandwidthFraction: Float,
    bufferedFractionToLiveEdgeForQualityIncrease: Float,
    clock: Clock!
)

Creates an adaptive track selection factory.

Public functions

Array<@NullableType ExoTrackSelection!>!
@NullableType
createTrackSelections(
    @NullableType definitions: Array<@NullableType ExoTrackSelection.Definition!>!,
    bandwidthMeter: BandwidthMeter!,
    mediaPeriodId: MediaSource.MediaPeriodId!,
    timeline: Timeline!
)

Creates track selections for the provided Definitions.

Protected functions

AdaptiveTrackSelection!
createAdaptiveTrackSelection(
    group: TrackGroup!,
    tracks: IntArray!,
    type: Int,
    bandwidthMeter: BandwidthMeter!,
    adaptationCheckpoints: ImmutableList<AdaptiveTrackSelection.AdaptationCheckpoint!>!
)

Creates a single adaptive selection for the given group, bandwidth meter and tracks.

Public constructors

Factory

Factory()

Creates an adaptive track selection factory with default parameters.

Factory

Factory(
    minDurationForQualityIncreaseMs: Int,
    maxDurationForQualityDecreaseMs: Int,
    minDurationToRetainAfterDiscardMs: Int,
    bandwidthFraction: Float
)

Creates an adaptive track selection factory.

Parameters
minDurationForQualityIncreaseMs: Int

The minimum duration of buffered data required for the selected track to switch to one of higher quality.

maxDurationForQualityDecreaseMs: Int

The maximum duration of buffered data required for the selected track to switch to one of lower quality.

minDurationToRetainAfterDiscardMs: Int

When switching to a video track of higher quality, the selection may indicate that media already buffered at the lower quality can be discarded to speed up the switch. This is the minimum duration of media that must be retained at the lower quality. It must be at least minDurationForQualityIncreaseMs.

bandwidthFraction: Float

The fraction of the available bandwidth that the selection should consider available for use. Setting to a value less than 1 is recommended to account for inaccuracies in the bandwidth estimator.

Factory

Factory(
    minDurationForQualityIncreaseMs: Int,
    maxDurationForQualityDecreaseMs: Int,
    minDurationToRetainAfterDiscardMs: Int,
    bandwidthFraction: Float,
    bufferedFractionToLiveEdgeForQualityIncrease: Float,
    clock: Clock!
)

Creates an adaptive track selection factory.

Parameters
minDurationForQualityIncreaseMs: Int

The minimum duration of buffered data required for the selected track to switch to one of higher quality.

maxDurationForQualityDecreaseMs: Int

The maximum duration of buffered data required for the selected track to switch to one of lower quality.

minDurationToRetainAfterDiscardMs: Int

When switching to a video track of higher quality, the selection may indicate that media already buffered at the lower quality can be discarded to speed up the switch. This is the minimum duration of media that must be retained at the lower quality. It must be at least minDurationForQualityIncreaseMs.

bandwidthFraction: Float

The fraction of the available bandwidth that the selection should consider available for use. Setting to a value less than 1 is recommended to account for inaccuracies in the bandwidth estimator.

bufferedFractionToLiveEdgeForQualityIncrease: Float

For live streaming, the fraction of the duration from current playback position to the live edge that has to be buffered before the selected track can be switched to one of higher quality. This parameter is only applied when the playback position is closer to the live edge than minDurationForQualityIncreaseMs, which would otherwise prevent switching to a higher quality from happening.

clock: Clock!

A Clock.

Factory

Factory(
    minDurationForQualityIncreaseMs: Int,
    maxDurationForQualityDecreaseMs: Int,
    minDurationToRetainAfterDiscardMs: Int,
    maxWidthToDiscard: Int,
    maxHeightToDiscard: Int,
    bandwidthFraction: Float
)

Creates an adaptive track selection factory.

Parameters
minDurationForQualityIncreaseMs: Int

The minimum duration of buffered data required for the selected track to switch to one of higher quality.

maxDurationForQualityDecreaseMs: Int

The maximum duration of buffered data required for the selected track to switch to one of lower quality.

minDurationToRetainAfterDiscardMs: Int

When switching to a video track of higher quality, the selection may indicate that media already buffered at the lower quality can be discarded to speed up the switch. This is the minimum duration of media that must be retained at the lower quality. It must be at least minDurationForQualityIncreaseMs.

maxWidthToDiscard: Int

The maximum video width that the selector may discard from the buffer to speed up switching to a higher quality.

maxHeightToDiscard: Int

The maximum video height that the selector may discard from the buffer to speed up switching to a higher quality.

bandwidthFraction: Float

The fraction of the available bandwidth that the selection should consider available for use. Setting to a value less than 1 is recommended to account for inaccuracies in the bandwidth estimator.

Factory

Factory(
    minDurationForQualityIncreaseMs: Int,
    maxDurationForQualityDecreaseMs: Int,
    minDurationToRetainAfterDiscardMs: Int,
    maxWidthToDiscard: Int,
    maxHeightToDiscard: Int,
    bandwidthFraction: Float,
    bufferedFractionToLiveEdgeForQualityIncrease: Float,
    clock: Clock!
)

Creates an adaptive track selection factory.

Parameters
minDurationForQualityIncreaseMs: Int

The minimum duration of buffered data required for the selected track to switch to one of higher quality.

maxDurationForQualityDecreaseMs: Int

The maximum duration of buffered data required for the selected track to switch to one of lower quality.

minDurationToRetainAfterDiscardMs: Int

When switching to a video track of higher quality, the selection may indicate that media already buffered at the lower quality can be discarded to speed up the switch. This is the minimum duration of media that must be retained at the lower quality. It must be at least minDurationForQualityIncreaseMs.

maxWidthToDiscard: Int

The maximum video width that the selector may discard from the buffer to speed up switching to a higher quality.

maxHeightToDiscard: Int

The maximum video height that the selector may discard from the buffer to speed up switching to a higher quality.

bandwidthFraction: Float

The fraction of the available bandwidth that the selection should consider available for use. Setting to a value less than 1 is recommended to account for inaccuracies in the bandwidth estimator.

bufferedFractionToLiveEdgeForQualityIncrease: Float

For live streaming, the fraction of the duration from current playback position to the live edge that has to be buffered before the selected track can be switched to one of higher quality. This parameter is only applied when the playback position is closer to the live edge than minDurationForQualityIncreaseMs, which would otherwise prevent switching to a higher quality from happening.

clock: Clock!

A Clock.

Public functions

createTrackSelections

@NullableType
fun createTrackSelections(
    @NullableType definitions: Array<@NullableType ExoTrackSelection.Definition!>!,
    bandwidthMeter: BandwidthMeter!,
    mediaPeriodId: MediaSource.MediaPeriodId!,
    timeline: Timeline!
): Array<@NullableType ExoTrackSelection!>!

Creates track selections for the provided Definitions.

Implementations that create at most one adaptive track selection may use createTrackSelectionsForDefinitions.

Parameters
@NullableType definitions: Array<@NullableType ExoTrackSelection.Definition!>!

A Definition array. May include null values.

bandwidthMeter: BandwidthMeter!

A BandwidthMeter which can be used to select tracks.

mediaPeriodId: MediaSource.MediaPeriodId!

The MediaPeriodId of the period for which tracks are to be selected.

timeline: Timeline!

The Timeline holding the period for which tracks are to be selected.

Returns
Array<@NullableType ExoTrackSelection!>!

The created selections. Must have the same length as definitions and may include null values.

Protected functions

createAdaptiveTrackSelection

protected fun createAdaptiveTrackSelection(
    group: TrackGroup!,
    tracks: IntArray!,
    type: Int,
    bandwidthMeter: BandwidthMeter!,
    adaptationCheckpoints: ImmutableList<AdaptiveTrackSelection.AdaptationCheckpoint!>!
): AdaptiveTrackSelection!

Creates a single adaptive selection for the given group, bandwidth meter and tracks.

Parameters
group: TrackGroup!

The TrackGroup.

tracks: IntArray!

The indices of the selected tracks in the track group.

type: Int

The type that will be returned from getType.

bandwidthMeter: BandwidthMeter!

A BandwidthMeter which can be used to select tracks.

adaptationCheckpoints: ImmutableList<AdaptiveTrackSelection.AdaptationCheckpoint!>!

The checkpoints that can be used to calculate available bandwidth for this selection.

Returns
AdaptiveTrackSelection!

An AdaptiveTrackSelection for the specified tracks.