SimpleBasePlayer.PositionSupplier


protected interface SimpleBasePlayer.PositionSupplier

Known direct subclasses
SimpleBasePlayer.LivePositionSupplier

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


A supplier for a position.

Convenience methods and classes for creating position suppliers:

  • Use getConstant for constant or non-moving positions.
  • Use getExtrapolating for positions advancing with the system clock from a provided start time.
  • Use LivePositionSupplier for positions that can be directly obtained from a live system. Note that these suppliers should be disconnected from the live source as soon as the position is no longer valid, for example after a position discontinuity.

Summary

Constants

default static final SimpleBasePlayer.PositionSupplier

An instance returning a constant position of zero.

Public methods

abstract long
get()

Returns the position.

default static SimpleBasePlayer.PositionSupplier
getConstant(long positionMs)

Returns an instance that returns a constant value.

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

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

Constants

ZERO

default static final SimpleBasePlayer.PositionSupplier ZERO

An instance returning a constant position of zero.

Public methods

get

abstract long get()

Returns the position.

getConstant

default static SimpleBasePlayer.PositionSupplier getConstant(long positionMs)

Returns an instance that returns a constant value.

Parameters
long positionMs

The constant position to return, in milliseconds.

getExtrapolating

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

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

Parameters
long currentPositionMs

The current position in milliseconds.

float playbackSpeed

The playback speed with which the position is assumed to increase.