# LivePlaybackSpeedControl

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/LivePlaybackSpeedControl.java+class:androidx.media3.exoplayer.LivePlaybackSpeedControl)

*** ** * ** ***


```
@UnstableApi
public interface LivePlaybackSpeedControl
```

<br />

Known direct subclasses [DefaultLivePlaybackSpeedControl](https://developer.android.com/reference/androidx/media3/exoplayer/DefaultLivePlaybackSpeedControl)

|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/DefaultLivePlaybackSpeedControl` | A `https://developer.android.com/reference/androidx/media3/exoplayer/LivePlaybackSpeedControl` that adjusts the playback speed using a proportional controller. |

*** ** * ** ***

Controls the playback speed while playing live content in order to maintain a steady target live offset.

## Summary

| ### Public methods |
|---|---|
| `abstract float` | `https://developer.android.com/reference/androidx/media3/exoplayer/LivePlaybackSpeedControl#getAdjustedPlaybackSpeed(long,long)(long liveOffsetUs, long bufferedDurationUs)` Returns the adjusted playback speed in order get closer towards the `https://developer.android.com/reference/androidx/media3/exoplayer/LivePlaybackSpeedControl#getTargetLiveOffsetUs()`. |
| `abstract long` | `https://developer.android.com/reference/androidx/media3/exoplayer/LivePlaybackSpeedControl#getTargetLiveOffsetUs()()` Returns the current target live offset, in microseconds, or `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` if no target live offset is defined for the current media. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/LivePlaybackSpeedControl#notifyRebuffer()()` Notifies the live playback speed control that a rebuffer occurred. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/LivePlaybackSpeedControl#setLiveConfiguration(androidx.media3.common.MediaItem.LiveConfiguration)(https://developer.android.com/reference/androidx/media3/common/MediaItem.LiveConfiguration liveConfiguration)` Sets the live configuration defined by the media. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/LivePlaybackSpeedControl#setTargetLiveOffsetOverrideUs(long)(long liveOffsetUs)` Sets the target live offset in microseconds that overrides the live offset `https://developer.android.com/reference/androidx/media3/exoplayer/LivePlaybackSpeedControl#setLiveConfiguration(androidx.media3.common.MediaItem.LiveConfiguration)` by the media. |

## Public methods

### getAdjustedPlaybackSpeed

```
abstract float getAdjustedPlaybackSpeed(long liveOffsetUs, long bufferedDurationUs)
```

Returns the adjusted playback speed in order get closer towards the `https://developer.android.com/reference/androidx/media3/exoplayer/LivePlaybackSpeedControl#getTargetLiveOffsetUs()`.

| Parameters |
|---|---|
| `long liveOffsetUs` | The current live offset, in microseconds. |
| `long bufferedDurationUs` | The duration of media that's currently buffered, in microseconds. |

| Returns |
|---|---|
| `float` | The adjusted factor by which playback should be sped up. |

### getTargetLiveOffsetUs

```
abstract long getTargetLiveOffsetUs()
```

Returns the current target live offset, in microseconds, or `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` if no target live offset is defined for the current media.

### notifyRebuffer

```
abstract void notifyRebuffer()
```

Notifies the live playback speed control that a rebuffer occurred.

A rebuffer is defined to be caused by buffer depletion rather than a user action. Hence this method is not called during initial buffering or when buffering as a result of a seek operation.

### setLiveConfiguration

```
abstract void setLiveConfiguration(MediaItem.LiveConfiguration liveConfiguration)
```

Sets the live configuration defined by the media.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/MediaItem.LiveConfiguration liveConfiguration` | The `https://developer.android.com/reference/androidx/media3/common/MediaItem.LiveConfiguration` as defined by the media. |

### setTargetLiveOffsetOverrideUs

```
abstract void setTargetLiveOffsetOverrideUs(long liveOffsetUs)
```

Sets the target live offset in microseconds that overrides the live offset `https://developer.android.com/reference/androidx/media3/exoplayer/LivePlaybackSpeedControl#setLiveConfiguration(androidx.media3.common.MediaItem.LiveConfiguration)` by the media. Passing `C.TIME_UNSET` deletes a previous override.

If no target live offset is configured by `https://developer.android.com/reference/androidx/media3/exoplayer/LivePlaybackSpeedControl#setLiveConfiguration(androidx.media3.common.MediaItem.LiveConfiguration)`, this override has no effect.