# StandaloneMediaClock

# StandaloneMediaClock

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

*** ** * ** ***

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

<br />

```
@UnstableApi
class StandaloneMediaClock : MediaClock
```

<br />

*** ** * ** ***

A[MediaClock](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/MediaClock)whose position advances with real time based on the playback parameters when started.

## Summary

|                                                                                                                                                                                                              ### Public constructors                                                                                                                                                                                                              |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [StandaloneMediaClock](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/StandaloneMediaClock#StandaloneMediaClock(androidx.media3.common.util.Clock))`(clock: `[Clock](https://developer.android.com/reference/kotlin/androidx/media3/common/util/Clock)`!)` Creates a new standalone media clock using the given[Clock](https://developer.android.com/reference/kotlin/androidx/media3/common/util/Clock)implementation. |

|                             ### Public functions                              |
|-------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | [getPositionUs](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/StandaloneMediaClock#getPositionUs())`()` Returns the current media position in microseconds.                                                                         |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [resetPosition](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/StandaloneMediaClock#resetPosition(long))`(positionUs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`)` Resets the clock's position. |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [start](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/StandaloneMediaClock#start())`()` Starts the clock.                                                                                                                           |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [stop](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/StandaloneMediaClock#stop())`()` Stops the clock.                                                                                                                              |

|                                               ### Public properties                                               |
|-------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------|
| [PlaybackParameters](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackParameters)`!` | [playbackParameters](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/StandaloneMediaClock#playbackParameters()) |

|                                                                                                                                                                                                                                                                                                                                                                                         ### Inherited functions                                                                                                                                                                                                                                                                                                                                                                                         |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From[androidx.media3.exoplayer.MediaClock](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/MediaClock) |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [hasSkippedSilenceSinceLastCall](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/MediaClock#hasSkippedSilenceSinceLastCall())`()` Returns whether there is a skipped silence since the last call to this method. | |

## Public constructors

### StandaloneMediaClock

```
StandaloneMediaClock(clock: Clock!)
```

Creates a new standalone media clock using the given[Clock](https://developer.android.com/reference/kotlin/androidx/media3/common/util/Clock)implementation.  

|                                              Parameters                                               |
|-------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------|
| `clock: `[Clock](https://developer.android.com/reference/kotlin/androidx/media3/common/util/Clock)`!` | A[Clock](https://developer.android.com/reference/kotlin/androidx/media3/common/util/Clock). |

## Public functions

### getPositionUs

```
fun getPositionUs(): Long
```

Returns the current media position in microseconds.  

### resetPosition

```
fun resetPosition(positionUs: Long): Unit
```

Resets the clock's position.  

|                                         Parameters                                          |
|---------------------------------------------------------------------------------------------|--------------------------------------|
| `positionUs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | The position to set in microseconds. |

### start

```
fun start(): Unit
```

Starts the clock. Does nothing if the clock is already started.  

### stop

```
fun stop(): Unit
```

Stops the clock. Does nothing if the clock is already stopped.  

## Public properties

### playbackParameters

```
var playbackParameters: PlaybackParameters!
```