# MediaPeriod.Callback

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

*** ** * ** ***


```
public interface MediaPeriod.Callback extends SequenceableLoader.Callback<MediaPeriod>
```

<br />

Known direct subclasses [ClippingMediaPeriod](https://developer.android.com/reference/androidx/media3/exoplayer/source/ClippingMediaPeriod), [MaskingMediaPeriod](https://developer.android.com/reference/androidx/media3/exoplayer/source/MaskingMediaPeriod)

|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/ClippingMediaPeriod` | Wraps a `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaPeriod` and clips its `https://developer.android.com/reference/androidx/media3/exoplayer/source/SampleStream`s to provide a subsequence of their samples. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/MaskingMediaPeriod` | Media period that defers calling `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource#createPeriod(androidx.media3.exoplayer.source.MediaSource.MediaPeriodId,androidx.media3.exoplayer.upstream.Allocator,long)` on a given source until `https://developer.android.com/reference/androidx/media3/exoplayer/source/MaskingMediaPeriod#createPeriod(androidx.media3.exoplayer.source.MediaSource.MediaPeriodId)` has been called. |

*** ** * ** ***

A callback to be notified of `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaPeriod` events.

## Summary

| ### Public methods |
|---|---|
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaPeriod.Callback#onPrepared(androidx.media3.exoplayer.source.MediaPeriod)(https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaPeriod mediaPeriod)` Called when preparation completes. |

### Inherited methods

From [androidx.media3.exoplayer.source.SequenceableLoader.Callback](https://developer.android.com/reference/androidx/media3/exoplayer/source/SequenceableLoader.Callback) `abstract void` `https://developer.android.com/reference/androidx/media3/exoplayer/source/SequenceableLoader.Callback#onContinueLoadingRequested(T)(T source)`

Called by the loader to indicate that it wishes for its `https://developer.android.com/reference/androidx/media3/exoplayer/source/SequenceableLoader#continueLoading(androidx.media3.exoplayer.LoadingInfo)` method to be called when it can continue to load data.

## Public methods

### onPrepared

```
abstract void onPrepared(MediaPeriod mediaPeriod)
```

Called when preparation completes.

Called on the playback thread. After invoking this method, the `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaPeriod` can expect for `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaPeriod#selectTracks(androidx.media3.exoplayer.trackselection.ExoTrackSelection[],boolean[],androidx.media3.exoplayer.source.SampleStream[],boolean[],long)` to be called with the initial track selection.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaPeriod mediaPeriod` | The prepared `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaPeriod`. |