# SingleSampleMediaChunk

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

*** ** * ** ***


```
@UnstableApi
public final class SingleSampleMediaChunk extends BaseMediaChunk
```

<br />

|---|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||||
| ↳ | [androidx.media3.exoplayer.source.chunk.Chunk](https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk) ||||
|   | ↳ | [androidx.media3.exoplayer.source.chunk.MediaChunk](https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaChunk) |||
|   |   | ↳ | [androidx.media3.exoplayer.source.chunk.BaseMediaChunk](https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/BaseMediaChunk) ||
|   |   |   | ↳ | [androidx.media3.exoplayer.source.chunk.SingleSampleMediaChunk](https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/SingleSampleMediaChunk) |

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
>
> The only use for this class is subtitle playback, but it is only compatible with legacy subtitle decoding, which is not supported by default. Users of this class almost certainly need to `https://developer.android.com/reference/androidx/media3/exoplayer/text/TextRenderer#experimentalSetLegacyDecodingEnabled(boolean)` on their `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer` instance in order to avoid playback errors when trying to play subtitles.

## Summary

| ### Public constructors |
|---|
| `[SingleSampleMediaChunk](https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/SingleSampleMediaChunk#SingleSampleMediaChunk(androidx.media3.datasource.DataSource,androidx.media3.datasource.DataSpec,androidx.media3.common.Format,int,java.lang.Object,long,long,long,int,androidx.media3.common.Format))( https://developer.android.com/reference/androidx/media3/datasource/DataSource dataSource, https://developer.android.com/reference/androidx/media3/datasource/DataSpec dataSpec, https://developer.android.com/reference/androidx/media3/common/Format trackFormat, @https://developer.android.com/reference/androidx/media3/common/C.SelectionReason int trackSelectionReason, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html trackSelectionData, long startTimeUs, long endTimeUs, long chunkIndex, @https://developer.android.com/reference/androidx/media3/common/C.TrackType int trackType, https://developer.android.com/reference/androidx/media3/common/Format sampleFormat )` **This method is deprecated.** Deprecated in Java |

| ### Public methods |
|---|---|
| `void` | `[cancelLoad](https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/SingleSampleMediaChunk#cancelLoad())()` **This method is deprecated.** Deprecated in Java |
| `boolean` | `[isLoadCompleted](https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/SingleSampleMediaChunk#isLoadCompleted())()` **This method is deprecated.** Deprecated in Java |
| `void` | `[load](https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/SingleSampleMediaChunk#load())()` **This method is deprecated.** Deprecated in Java |

### Inherited fields

From [androidx.media3.exoplayer.source.chunk.BaseMediaChunk](https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/BaseMediaChunk) `final long` `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/BaseMediaChunk#clippedEndTimeUs()`

**This field is deprecated.** Deprecated in Java
`final long` `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/BaseMediaChunk#clippedStartTimeUs()`

**This field is deprecated.** Deprecated in Java
`@https://checkerframework.org/api/org/checkerframework/checker/nullness/qual/MonotonicNonNull.html https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/BaseMediaChunkOutput` `@https://checkerframework.org/api/org/checkerframework/checker/nullness/qual/MonotonicNonNull.html
https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/BaseMediaChunk#output()`

**This field is deprecated.** Deprecated in Java
From [androidx.media3.exoplayer.source.chunk.Chunk](https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk) `final https://developer.android.com/reference/androidx/media3/datasource/StatsDataSource` `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk#dataSource()`

**This field is deprecated.** Deprecated in Java
`final https://developer.android.com/reference/androidx/media3/datasource/DataSpec` `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk#dataSpec()`

**This field is deprecated.** Deprecated in Java
`final long` `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk#endTimeUs()`

**This field is deprecated.** Deprecated in Java
`final long` `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk#loadTaskId()`

**This field is deprecated.** Deprecated in Java
`final long` `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk#startTimeUs()`

**This field is deprecated.** Deprecated in Java
`final @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk#steeredPathwayId()`

**This field is deprecated.** Deprecated in Java
`final https://developer.android.com/reference/androidx/media3/common/Format` `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk#trackFormat()`

**This field is deprecated.** Deprecated in Java
`final @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html` `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk#trackSelectionData()`

**This field is deprecated.** Deprecated in Java
`final int` `@https://developer.android.com/reference/androidx/media3/common/C.SelectionReason
https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk#trackSelectionReason()`

**This field is deprecated.** Deprecated in Java
`final int` `@https://developer.android.com/reference/androidx/media3/common/C.DataType
https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk#type()`

**This field is deprecated.** Deprecated in Java
From [androidx.media3.exoplayer.source.chunk.MediaChunk](https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaChunk) `final long` `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaChunk#chunkIndex()`

**This field is deprecated.** Deprecated in Java

### Inherited methods

From [androidx.media3.exoplayer.source.chunk.BaseMediaChunk](https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/BaseMediaChunk) `final int` `[getFirstSampleIndex](https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/BaseMediaChunk#getFirstSampleIndex(int))(int trackIndex)`

**This method is deprecated.** Deprecated in Java
`final https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/BaseMediaChunkOutput` `[getOutput](https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/BaseMediaChunk#getOutput())()`

**This method is deprecated.** Deprecated in Java
`void` `[init](https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/BaseMediaChunk#init(androidx.media3.exoplayer.source.chunk.BaseMediaChunkOutput))(https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/BaseMediaChunkOutput output)`

**This method is deprecated.** Deprecated in Java
From [androidx.media3.exoplayer.source.chunk.Chunk](https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk) `final long` `[bytesLoaded](https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk#bytesLoaded())()`

**This method is deprecated.** Deprecated in Java
`final long` `[getDurationUs](https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk#getDurationUs())()`

**This method is deprecated.** Deprecated in Java
`final https://developer.android.com/reference/java/util/Map.html<https://developer.android.com/reference/java/lang/String.html, https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/String.html>>` `[getResponseHeaders](https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk#getResponseHeaders())()`

**This method is deprecated.** Deprecated in Java
`final https://developer.android.com/reference/android/net/Uri.html` `[getUri](https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk#getUri())()`

**This method is deprecated.** Deprecated in Java
From [androidx.media3.exoplayer.source.chunk.MediaChunk](https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaChunk) `long` `[getNextChunkIndex](https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaChunk#getNextChunkIndex())()`

**This method is deprecated.** Deprecated in Java

## Public constructors

### SingleSampleMediaChunk

```
public [SingleSampleMediaChunk](https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/SingleSampleMediaChunk#SingleSampleMediaChunk(androidx.media3.datasource.DataSource,androidx.media3.datasource.DataSpec,androidx.media3.common.Format,int,java.lang.Object,long,long,long,int,androidx.media3.common.Format))(
    DataSource dataSource,
    DataSpec dataSpec,
    Format trackFormat,
    @C.SelectionReason int trackSelectionReason,
    @Nullable Object trackSelectionData,
    long startTimeUs,
    long endTimeUs,
    long chunkIndex,
    @C.TrackType int trackType,
    Format sampleFormat
)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/datasource/DataSource dataSource` | The source from which the data should be loaded. |
| `https://developer.android.com/reference/androidx/media3/datasource/DataSpec dataSpec` | Defines the data to be loaded. |
| `https://developer.android.com/reference/androidx/media3/common/Format trackFormat` | See `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk#trackFormat()`. |
| `@https://developer.android.com/reference/androidx/media3/common/C.SelectionReason int trackSelectionReason` | See `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk#trackSelectionReason()`. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html trackSelectionData` | See `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk#trackSelectionData()`. |
| `long startTimeUs` | The start time of the media contained by the chunk, in microseconds. |
| `long endTimeUs` | The end time of the media contained by the chunk, in microseconds. |
| `long chunkIndex` | The index of the chunk, or `https://developer.android.com/reference/androidx/media3/common/C#INDEX_UNSET()` if it is not known. |
| `@https://developer.android.com/reference/androidx/media3/common/C.TrackType int trackType` | The `https://developer.android.com/reference/androidx/media3/common/C.TrackType` of the chunk. |
| `https://developer.android.com/reference/androidx/media3/common/Format sampleFormat` | The `https://developer.android.com/reference/androidx/media3/common/Format` of the sample in the chunk. |

## Public methods

### cancelLoad

```
public void [cancelLoad](https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/SingleSampleMediaChunk#cancelLoad())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Cancels the load.

Loadable implementations should ensure that a currently executing `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/Loader.Loadable#load()` call will exit reasonably quickly after this method is called. The `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/Loader.Loadable#load()` call may exit either by returning or by throwing an `https://developer.android.com/reference/java/io/IOException.html`.

If there is a currently executing `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/Loader.Loadable#load()` call, then the thread on which that call is being made will be interrupted immediately after the call to this method. Hence implementations do not need to (and should not attempt to) interrupt the loading thread themselves.

Although the loading thread will be interrupted, Loadable implementations should not use the interrupted status of the loading thread in `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/Loader.Loadable#load()` to determine whether the load has been canceled. This approach is not robust \[Internal ref: b/79223737\]. Instead, implementations should use their own flag to signal cancelation (for example, using `https://developer.android.com/reference/java/util/concurrent/atomic/AtomicBoolean.html`).

### isLoadCompleted

```
public boolean [isLoadCompleted](https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/SingleSampleMediaChunk#isLoadCompleted())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Returns whether the chunk has been fully loaded.

### load

```
public void [load](https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/SingleSampleMediaChunk#load())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Performs the load, returning on completion or cancellation.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/io/IOException.html` | If the input could not be loaded. |