SimpleBasePlayer.LivePositionSupplier


protected final class SimpleBasePlayer.LivePositionSupplier implements SimpleBasePlayer.PositionSupplier


A PositionSupplier connected to a live provider that returns a new value on each invocation until it is disconnected from the live source.

The recommended usage of this class is to create a new instance connected to the live source and keep returning this instance as long as the position source is still valid. As soon as the position source becomes invalid, for example when handling a position discontinuity, call disconnect with the final position that will be returned for all future invocations.

Summary

Public constructors

Creates the live position supplier.

Public methods

void
disconnect(long finalValue)

Disconnects the position supplier from the live source.

long
get()

Returns the position.

Inherited Constants

From androidx.media3.common.SimpleBasePlayer.PositionSupplier
static final SimpleBasePlayer.PositionSupplier

An instance returning a constant position of zero.

Inherited methods

From androidx.media3.common.SimpleBasePlayer.PositionSupplier
static SimpleBasePlayer.PositionSupplier
getConstant(long positionMs)

Returns an instance that returns a constant value.

static SimpleBasePlayer.PositionSupplier
getExtrapolating(long currentPositionMs, float playbackSpeed)

Returns an instance that extrapolates the provided position into the future.

Public constructors

LivePositionSupplier

public LivePositionSupplier(SimpleBasePlayer.PositionSupplier livePosition)

Creates the live position supplier.

Parameters
SimpleBasePlayer.PositionSupplier livePosition

The function returning the live position.

Public methods

disconnect

public void disconnect(long finalValue)

Disconnects the position supplier from the live source.

All future invocations of get will return the provided final position.

Parameters
long finalValue

The final position value.

get

public long get()

Returns the position.