HlsContentSteeringTracker


@UnstableApi
public final class HlsContentSteeringTracker extends BaseContentSteeringTracker


Tracks the content steering states for an HLS stream.

Summary

Nested types

A callback to be notified of HlsContentSteeringTracker events.

Public constructors

HlsContentSteeringTracker(
    HlsDataSourceFactory dataSourceFactory,
    @Nullable Supplier<ReleasableExecutor> downloadExecutorSupplier,
    HlsPlaylistTracker playlistTracker,
    @Nullable HlsContentSteeringTracker.Callback callback,
    BandwidthMeter bandwidthMeter,
    Clock clock
)

Creates an HlsContentSteeringTracker.

Public methods

boolean
excludeCurrentPathway(long excludeDurationMs)

Excludes the current pathway for the given duration.

Protected methods

ImmutableMap<String, String>

Returns the query parameters to include in the steering manifest request.

boolean

Returns whether the given pathway is currently available.

void
onStart(ImmutableList<String> initialPathwayIds)

Called when the tracker is started.

void

Called when tracking is stopped.

void

Performs a pathway clone defined in the steering manifest.

void

Performs a pathway evaluation based on the passed pathway priority.

Inherited methods

From androidx.media3.exoplayer.upstream.contentsteering.BaseContentSteeringTracker
static Uri
applyUriReplacement(
    Uri baseUri,
    SteeringManifest.UriReplacement uriReplacement
)

Applies a SteeringManifest.UriReplacement to a base URI.

final @Nullable ImmutableList<String>

Returns the current pathway priority.

final boolean

Returns whether the Content Steering tracker is active.

final void

Releases the Content Steering tracker.

final void
start(
    Uri initialSteeringManifestUri,
    ImmutableList<String> initialPathwayIds,
    MediaSourceEventListener.EventDispatcher eventDispatcher
)

Starts the Content Steering tracker.

Public constructors

HlsContentSteeringTracker

public HlsContentSteeringTracker(
    HlsDataSourceFactory dataSourceFactory,
    @Nullable Supplier<ReleasableExecutor> downloadExecutorSupplier,
    HlsPlaylistTracker playlistTracker,
    @Nullable HlsContentSteeringTracker.Callback callback,
    BandwidthMeter bandwidthMeter,
    Clock clock
)

Creates an HlsContentSteeringTracker.

Parameters
HlsDataSourceFactory dataSourceFactory

The HlsDataSourceFactory.

@Nullable Supplier<ReleasableExecutor> downloadExecutorSupplier

A supplier to obtain a ReleasableExecutor, or null.

HlsPlaylistTracker playlistTracker

The HlsPlaylistTracker.

@Nullable HlsContentSteeringTracker.Callback callback

A HlsContentSteeringTracker.Callback to receive events, or null.

BandwidthMeter bandwidthMeter

The BandwidthMeter.

Clock clock

The Clock.

Public methods

excludeCurrentPathway

public boolean excludeCurrentPathway(long excludeDurationMs)

Excludes the current pathway for the given duration.

Parameters
long excludeDurationMs

The duration in milliseconds to exclude the current pathway.

Returns
boolean

Whether the current pathway was excluded.

Protected methods

getSteeringQueryParameters

protected ImmutableMap<String, String> getSteeringQueryParameters()

Returns the query parameters to include in the steering manifest request.

isPathwayAvailable

protected boolean isPathwayAvailable(String pathwayId)

Returns whether the given pathway is currently available.

Parameters
String pathwayId

The ID of the pathway to check.

Returns
boolean

Whether the given pathway is available.

onStart

protected void onStart(ImmutableList<String> initialPathwayIds)

Called when the tracker is started.

Parameters
ImmutableList<String> initialPathwayIds

The IDs of the initial pathways to be used before the first steering manifest is loaded.

onStop

protected void onStop()

Called when tracking is stopped.

This can be either externally called by release or internally due to an unrecoverable error.

performPathwayClone

protected void performPathwayClone(SteeringManifest.PathwayClone pathwayClone)

Performs a pathway clone defined in the steering manifest.

Parameters
SteeringManifest.PathwayClone pathwayClone

The SteeringManifest.PathwayClone to perform.

performPathwayEvaluation

protected void performPathwayEvaluation(ImmutableList<String> pathwayPriority)

Performs a pathway evaluation based on the passed pathway priority.

Parameters
ImmutableList<String> pathwayPriority

The pathway priority to use for evaluation.