# SimpleBasePlayer.LivePositionSupplier

# SimpleBasePlayer.LivePositionSupplier

Artifact:[androidx.media3:media3-common](https://developer.android.com/jetpack/androidx/releases/media3)  
[View Source](https://cs.android.com/search?q=file:androidx/media3/common/SimpleBasePlayer.java+class:androidx.media3.common.SimpleBasePlayer.LivePositionSupplier)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.LivePositionSupplier "View this page in Java")

<br />

```
class SimpleBasePlayer.LivePositionSupplier : SimpleBasePlayer.PositionSupplier
```

<br />

*** ** * ** ***

A[PositionSupplier](https://developer.android.com/reference/kotlin/androidx/media3/common/SimpleBasePlayer.PositionSupplier)connected to a live provider that returns a new value on each invocation until it is[disconnected](https://developer.android.com/reference/kotlin/androidx/media3/common/SimpleBasePlayer.LivePositionSupplier#disconnect(long))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](https://developer.android.com/reference/kotlin/androidx/media3/common/SimpleBasePlayer.LivePositionSupplier#disconnect(long))with the final position that will be returned for all future invocations.

## Summary

|                                                                                                                                                                                                 ### Public constructors                                                                                                                                                                                                 |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [LivePositionSupplier](https://developer.android.com/reference/kotlin/androidx/media3/common/SimpleBasePlayer.LivePositionSupplier#LivePositionSupplier(androidx.media3.common.SimpleBasePlayer.PositionSupplier))`(livePosition: `[SimpleBasePlayer.PositionSupplier](https://developer.android.com/reference/kotlin/androidx/media3/common/SimpleBasePlayer.PositionSupplier)`!)` Creates the live position supplier. |

|                             ### Public functions                              |
|-------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [disconnect](https://developer.android.com/reference/kotlin/androidx/media3/common/SimpleBasePlayer.LivePositionSupplier#disconnect(long))`(finalValue: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`)` Disconnects the position supplier from the live source. |
| [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | [get](https://developer.android.com/reference/kotlin/androidx/media3/common/SimpleBasePlayer.LivePositionSupplier#get())`()` Returns the position.                                                                                                                                                |

|                                                                                                                                                                                                                                                                                                                                                                                                                 ### Inherited Constants                                                                                                                                                                                                                                                                                                                                                                                                                 |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From[androidx.media3.common.SimpleBasePlayer.PositionSupplier](https://developer.android.com/reference/kotlin/androidx/media3/common/SimpleBasePlayer.PositionSupplier) |---------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `const `[SimpleBasePlayer.PositionSupplier](https://developer.android.com/reference/kotlin/androidx/media3/common/SimpleBasePlayer.PositionSupplier)`!` | [ZERO](https://developer.android.com/reference/kotlin/androidx/media3/common/SimpleBasePlayer.PositionSupplier#ZERO()) An instance returning a constant position of zero. | |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ### Inherited functions                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From[androidx.media3.common.SimpleBasePlayer.PositionSupplier](https://developer.android.com/reference/kotlin/androidx/media3/common/SimpleBasePlayer.PositionSupplier) |---------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `java-static `[SimpleBasePlayer.PositionSupplier](https://developer.android.com/reference/kotlin/androidx/media3/common/SimpleBasePlayer.PositionSupplier)`!` | [getConstant](https://developer.android.com/reference/kotlin/androidx/media3/common/SimpleBasePlayer.PositionSupplier#getConstant(long))`(positionMs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`)` Returns an instance that returns a constant value.                                                                                                                                                    | | `java-static `[SimpleBasePlayer.PositionSupplier](https://developer.android.com/reference/kotlin/androidx/media3/common/SimpleBasePlayer.PositionSupplier)`!` | [getExtrapolating](https://developer.android.com/reference/kotlin/androidx/media3/common/SimpleBasePlayer.PositionSupplier#getExtrapolating(long,float))`(currentPositionMs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`, playbackSpeed: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`)` 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](https://developer.android.com/reference/kotlin/androidx/media3/common/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](https://developer.android.com/reference/kotlin/androidx/media3/common/SimpleBasePlayer.LivePositionSupplier#get())will return the provided final position.  

|                                         Parameters                                          |
|---------------------------------------------------------------------------------------------|---------------------------|
| `finalValue: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | The final position value. |

### get

```
fun get(): Long
```

Returns the position.