HlsContentSteeringTracker


@UnstableApi
public final class HlsContentSteeringTracker implements ContentSteeringTracker


Tracks the content steering states for an HLS stream.

Summary

Nested types

A callback to be notified of HlsContentSteeringTracker events.

Public fields

boolean

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, in milliseconds.

boolean

Returns whether the ContentSteeringTracker is active.

void
start(
    Uri initialSteeringManifestUri,
    @Nullable String initialPathwayId,
    MediaSourceEventListener.EventDispatcher eventDispatcher
)

Starts the .

void

Stops the ContentSteeringTracker.

Public fields

isActive

public boolean isActive

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 to create data sources for loading steering manifests.

@Nullable Supplier<ReleasableExecutor> downloadExecutorSupplier

A supplier to obtain a ReleasableExecutor for downloading steering manifests, or null.

HlsPlaylistTracker playlistTracker

The HlsPlaylistTracker.

@Nullable HlsContentSteeringTracker.Callback callback

A Callback to receive events, or null.

BandwidthMeter bandwidthMeter

The BandwidthMeter to obtain throughput estimates.

Clock clock

The Clock to schedule handler messages.

Public methods

excludeCurrentPathway

public boolean excludeCurrentPathway(long excludeDurationMs)

Excludes the current pathway for the given duration, in milliseconds.

Parameters
long excludeDurationMs

The duration for which to exclude the current pathway.

Returns
boolean

Whether the exclusion was successful.

isActive

public boolean isActive()

Returns whether the ContentSteeringTracker is active.

If this method returns false, the caller of the ContentSteeringTracker should behave as if content steering is absent.

start

public void start(
    Uri initialSteeringManifestUri,
    @Nullable String initialPathwayId,
    MediaSourceEventListener.EventDispatcher eventDispatcher
)

Starts the .

Throws
java.lang.IllegalStateException

If the initialPathwayId is not declared in the redundant group.

stop

public void stop()

Stops the ContentSteeringTracker.