SimpleBasePlayer.LivePositionSupplier


protected class SimpleBasePlayer.LivePositionSupplier : 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 functions

Unit
disconnect(finalValue: Long)

Disconnects the position supplier from the live source.

Long
get()

Returns the position.

Inherited Constants

From androidx.media3.common.SimpleBasePlayer.PositionSupplier
const SimpleBasePlayer.PositionSupplier!

An instance returning a constant position of zero.

Inherited functions

From androidx.media3.common.SimpleBasePlayer.PositionSupplier
java-static SimpleBasePlayer.PositionSupplier!
getConstant(positionMs: Long)

Returns an instance that returns a constant value.

java-static SimpleBasePlayer.PositionSupplier!
getExtrapolating(currentPositionMs: Long, playbackSpeed: Float)

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

Public constructors

LivePositionSupplier

LivePositionSupplier(livePosition: SimpleBasePlayer.PositionSupplier!)

Creates the live position supplier.

Parameters
livePosition: SimpleBasePlayer.PositionSupplier!

The function returning the live position.

Public functions

disconnect

fun disconnect(finalValue: Long): Unit

Disconnects the position supplier from the live source.

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

Parameters
finalValue: Long

The final position value.

get

fun get(): Long

Returns the position.