Package com.google.android.exoplayer2.util

## Class StandaloneMediaClock

- java.lang.Object
- - com.google.android.exoplayer2.util.StandaloneMediaClock

- All Implemented Interfaces:
    `MediaClock`

      public final class StandaloneMediaClock
      extends Object
      implements MediaClock

  A `MediaClock` whose position advances with real time based on the playback parameters when started.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `StandaloneMediaClock​(Clock clock)` | Creates a new standalone media clock using the given `Clock` implementation.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `PlaybackParameters` | `getPlaybackParameters()` | Returns the active playback parameters.
    `long` | `getPositionUs()` | Returns the current media position in microseconds.
    `void` | `resetPosition​(long positionUs)` | Resets the clock's position.
    `void` | `setPlaybackParameters​(PlaybackParameters playbackParameters)` | Attempts to set the playback parameters.
    `void` | `start()` | Starts the clock.
    `void` | `stop()` | Stops the clock.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### StandaloneMediaClock

          public StandaloneMediaClock​(Clock clock)

      Creates a new standalone media clock using the given `Clock` implementation.
      Parameters:
        `clock` - A `Clock`.

  - ### Method Detail

    - #### start

          public void start()

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

    - #### stop

          public void stop()

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

    - #### resetPosition

          public void resetPosition​(long positionUs)

      Resets the clock's position.
      Parameters:
        `positionUs` - The position to set in microseconds.

    - #### getPositionUs

          public long getPositionUs()

      Description copied from interface: `MediaClock`
      Returns the current media position in microseconds.
      Specified by:
        `getPositionUs` in interface `MediaClock`

    - #### setPlaybackParameters

          public void setPlaybackParameters​(PlaybackParameters playbackParameters)

      Description copied from interface: `MediaClock`
      Attempts to set the playback parameters. The media clock may override the speed if changing the playback parameters is not supported.
      Specified by:
        `setPlaybackParameters` in interface `MediaClock`
      Parameters:
        `playbackParameters` - The playback parameters to attempt to set.

    - #### getPlaybackParameters

          public PlaybackParameters getPlaybackParameters()

      Description copied from interface: `MediaClock`
      Returns the active playback parameters.
      Specified by:
        `getPlaybackParameters` in interface `MediaClock`